Lance,
Check the Javadocs.
The method name is endsWith(String s)

You can't use a switch statement b/c endsWith returns a boolean. You would
have to use a if-else if    construct.

You need something like:
String fileName;
.
.
.
/* assign a string to filename */
if (filename.endsWith(".txt")
{
         // Do something
}
else if (filename.endsWith(".pdf")
{

}
// etc.
.
.
.


Regards,

Richard

At 06:17 PM 4/11/2002 -0500, you wrote:
>I have two questions:
>
>1. I have the following line:
>         ConnectMode_OfficeMode.pdf
>    I want to check to see what the .filetype is.  I assume I would use
>    If endswith(txt)
>         {
>                 DO SOMETHING
>         }
>It is not working?
>
>2. I have multiple items that I will be checking therefore I was thinking of
>using  switch...case
>    String s = null;
>    Switch(test)
>         {
>                 case endswith(txt)
>                 s= something;
>                 case endswith(doc)
>                 s= something else;
>                 case endswith(html)
>                 s= something more;
>      }
>This does not seem to work.
>
>COuld someone either take a look at the code and let me know what you see.
>
>Thanks is advance
>Lance
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to