tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Baker <raschar...@yahoo.com>
Subject Re: finding a character in a string
Date Fri, 28 Jun 2002 13:41:01 GMT

--- Seth Brahler <spb32@cornell.edu> wrote:
> 
> 
> i have a string variable. I need to find a character
> within that string and 
> then remove everything that appears before that
> character.
> can someone push me in the right direction?
> 
> thanks.
> 

String s = "This is a string";
int i = s.indexOf("a"); // i = 8
String s2 = s.substring(i); // s2 = "a string"

or 

String s = "This is a string";
String s2 = s.substring(s.indexOf("a"));


<<SNIP>>

=====
rascharles@yahoo.com
Hacking is a "Good Thing!"
See http://www.tuxedo.org/~esr/faqs/hacker-howto.html

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message