parsing / regex?

From: Robocop (rob-cop_at_excite.com)
Date: 02/29/04

  • Next message: Todd de Gruyl: "Re: OSX FruitMenu-aware app?"
    Date: 28 Feb 2004 15:44:02 -0800
    
    

    Hi folks!

    I have a file say data.txt which has data as follows:
    _____________________
    c 500
      c2100 //<=== problem line
    p 550
      c 5950
     c 3000
    _____________________

    when the line

      (1) String trancode = tok2.nextToken().toUpperCase(); // this is
    for c, p, c given in the file (2) String stram =
    tok2.nextToken(); // this is for amount i.e. nos. 500 , 2100, 5950 etc
     (problem line)

    when line (2) gets executed I get token (i.e. String) as c2100!!! but
    i only want 2100 ! thus i can't "parse" it to DOUBLE number!

    should i use regex and replace?? if yes then please help on how to
    implement "regex" so that i only get the string required which can be
    parsed

    I used following method but i am getting runtime error!!!
    I used following following code but doesn't work!!!

    String finstr = "PCL";

    if( stra.charAt(0) ==
    finstr.charAt(finstr.indexOf(stra.charAt(0)))); {String stram =
    stra.substring(1, stra.length()); }

    many thanks for any help!!! :)


  • Next message: Todd de Gruyl: "Re: OSX FruitMenu-aware app?"