This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes find particular characters within a String ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "find particular characters within a String ? " Watch "find particular characters within a String ? " New topic
Author

find particular characters within a String ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
How to find particular characters within a String ? indexOf() (or) contains() (or) any other optimized way ? Which is the best option ?
Daesung Park
Ranch Hand

Joined: Mar 22, 2007
Posts: 68
I think indexOf() is enough.


Daesung Park

BLOG
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
If i use indexOf(), can i find last occurrence of a character or a substring in the invoking string (or) can i use lastIndexOf() ?
Prashant Ladha
Greenhorn

Joined: Feb 06, 2008
Posts: 8
Also, please look at regex.
Prashant Ladha
Greenhorn

Joined: Feb 06, 2008
Posts: 8
Originally posted by kri shan:
If i use indexOf(), can i find last occurrence of a character or a substring in the invoking string (or) can i use lastIndexOf() ?


yes, with lastIndexOf(String) you would get the last occurrence of that string.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: find particular characters within a String ?
 
Similar Threads
email hyperlink
how to find the number of characters in a string
Searching a String for a sequence of characters
how to know the string is number or charactor?
getRuntime().exec() vs cmd prompt