yeah there are a number of methods:

These two will find the position of the specified character or string.  A -1
means no match was found
String.charAt(' ')
String.indexOf(" ");

Will replace all ' ' with +'s
String.replace(' ','+');

Although, I don't understand why you would want to do this?  If it is for a
URL, there is a method for encoding URLS in java.net.URLEncoder that will do
it for you. And I think there are some other methods in the Servlet API as
well.

Chris Gow

> -----Original Message-----
> From: Sam Rose [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 12, 1999 9:26 AM
> To:   [EMAIL PROTECTED]
> Subject:      Determining if there is a space in a string,
>
> Hello all,
>
> One of my servlet's receives a parameter in the form of a string, is
> there anyway I can search this string and find if there are any spaces
> in it?
> And if so is there anyway of changing the space with a plus sign?
>
>
> Cheers
>
> __________________________________________________________________________
> _
> 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