Parsing Problem in Java
hi everyone, help me with this problem.
I have a string like this:
Now i need a code to search for the string "Condition:" and after its found, i should get only 'critical' as output.
Is there any code to implement this other than string tokenizer?
Don't cross-post! It is extremely rude!
See the API docs for String, there are a number of ways to do this. replaceFirst, replaceAll, charAt combined with substring, replace, etc.
Thanks for ur kind reply.
And i cross-posted it by mistake, and this wont be repeated.
Depending on what you are trying to do, I like to use a Pattern and Matcher to search and extract using regular expressions. You can use groupings '()' to extract parts of your pattern match and use these as your output. See: Pattern (Java 2 Platform SE v1.4.2)
Thanks a lot for your reply friend. will try that out.