• Post Reply Bookmark Topic Watch Topic
  • New Topic

to find and retrieve a number in a string  RSS feed

 
meenu teenu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to find and retrieve a number in string.

For eg,
in "emp1_fname" i should retrieve "1" from that string....how it is possible.If i use string tokenizer will it be possible?Reply ASAP
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far ?

Have a look at String.substring, String.split, java.util.regexp....

Please reply ASAP.

pascal
 
Sanjit Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one of the easy way to to do is :
First convert the string to char array and then read each character and match that with 0 to 9 and print.


if not statisfied then reply back ASAP.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!