• Post Reply Bookmark Topic Watch Topic
  • New Topic

looking for java parasers for parsing string expressions  RSS feed

 
Oni Anand
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am looking for java parasers for parsing string expressions.
could pls someone tell me about few good java parsers for parsing a string.
 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can pars object of any class into its child class ....
but here ur question is quite ambigous to understand actually...
what is ur requirment....
explain ur requirment first
 
Neaman Shafiq
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
u could provide a bit more info regarding wot u wanna parse exactly. hav u tried using string tokenizers?
for example, if i define a string as follows:
String expr="<HTML> <H1> parse this </H1> </HTML>";
-say i wanna parse this and extract from it each of the html tags, say <HTML>, then i create a string tokenizer:
StringTokenizer tokens = new StringTokenizer(expr);
-to get the first token or sub-string <HTML>, i just say:
Sting html=tokens.nextToken();
-so u could hav a loop which prints all the sub strings:
while(tokens.hasMoreElements())
{
System.out.println(tokens.nextToken());
}
-hope this helps.
neamz
 
Neaman Shafiq
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry about the way my answer has come out. i used a string expression which had html tags in it. the browser has outputted these in HTML - this wasnt my intention. maybe i picked a bad example...
neamz
 
Oni Anand
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
thanks to everyone for their responses.....
you all are real helpful
tx
AA
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!