It seems to be working fine with one exception "doc.field", I have used this
through my app with out any problems. Iam getting an "Unable to compile
class" error. The string "url" is being read from a bif file in verity which
contains a string similar to this:

/data/verity/custom-kb/content/solutions/gold/55.0.13769927.2880318.html


This is my code:
                String image="";
                String url=(doc.field("VdkVgwKey"));
                String file=url.substring(url.lastIndexOf("/"), url.length());
                        if(file.endsWith(".txt") || file.endsWith(".TXT")) {
                                image="test";
                            }

Anyone see whaere I am going wrong.. Thank you again in advance.


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Erik
Morton
Sent: Friday, April 26, 2002 3:46 PM
To: [EMAIL PROTECTED]
Subject: Re: Endswith()


If I understand your question correctly, you may want to try this:

String url =
"/data/verity/custom-kb/content/solutions/gold/55.0.13769927.2880318.html";
String file = url.substring(url.lastIndexOf("/"), url.length());
if(file.endsWith(".html") || file.endsWith(".HTML")) {
///yada yada yada
}

Now, notice that comparing the last characters of the file string is
imprecise,
because in theory a url like http://host.com/myFile.HtMl is valid.




Lance Prais wrote:

> I am new to Programming, Can anyone explain how to use endswith()
>
> For example I want to check this field to see what the .filetype is: I can
> not seem to grasp it with this field:
>
> /data/verity/custom-kb/content/solutions/gold/55.0.13769927.2880318.html.
>
> Thank you in 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

--
Erik I Morton
Developer
------------------
CommerceHub
http://www.commercehub.com
518-886-0704
21 Corporate Drive
Clifton Park, NY 12065

___________________________________________________________________________
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