aspose file tools
The moose likes Beginning Java and the fly likes find particular characters within a String ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 1300
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: 1300
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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: find particular characters within a String ?
 
Similar Threads
getRuntime().exec() vs cmd prompt
how to find the number of characters in a string
email hyperlink
Searching a String for a sequence of characters
how to know the string is number or charactor?