If I do use the correct syntax I still get the error. It really bizarre considering two lines later it the code I am using doc.field with out any error.
-----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: Monday, April 29, 2002 6:48 AM To: [EMAIL PROTECTED] Subject: Re: Endswith() Your code snippet: String url=(doc.field("VdkVgwKey")); Is not valid syntax. If they the field method returns a string use the following code: String url = doc.field("xxx"); Parenthesis have no meaning the way you were using them. Lance Prais wrote: > 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 Lance > Prais > Sent: Friday, April 26, 2002 4:05 PM > To: [EMAIL PROTECTED] > Subject: Re: Endswith() > > Thanks > > -----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:56 PM > To: [EMAIL PROTECTED] > Subject: Re: Endswith() > > Yeah, or toUpperCase/toLowerCase. > > "Galbreath, Mark" wrote: > > > do an equalsIgnoreCase() then.... > > > > -----Original Message----- > > From: Erik Morton [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 26, 2002 4: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 > > -- > 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 > > ___________________________________________________________________________ > 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
