Results 1 to 5 of 5
  1. #1
    vidya is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default Parsing Problem in Java

    hi everyone, help me with this problem.

    I have a string like this:
    "Condition: Critical"

    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?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    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.

  3. #3
    vidya is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default

    @masijade

    Thanks for ur kind reply.

    And i cross-posted it by mistake, and this wont be repeated.

  4. #4
    BSA
    BSA is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default

    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)

  5. #5
    vidya is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default

    @ BSA

    Thanks a lot for your reply friend. will try that out.

Similar Threads

  1. Replies: 1
    Last Post: 05-31-2009, 06:48 PM
  2. Replies: 0
    Last Post: 06-28-2008, 04:54 AM
  3. Replies: 0
    Last Post: 06-10-2008, 07:37 AM
  4. parsing problem
    By Pooja Deshpande in forum Advanced Java
    Replies: 4
    Last Post: 05-29-2008, 01:59 PM
  5. Parsing URL in Java
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •