• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert string to number

 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have string like

/$VVCk*KKKKL4208.56DDDD
EUR 6666.37 GGGG RRRRR LLLL /KKKK

I need to retrieve only 6666.37.

Can anyone help me in this case?

thanks


 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12102
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried?
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried only string.substring(int start, int end).

do we have any other alternative also?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12102
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could try regular expressions, too. part of the difficulty of helping you is that your data layout isn't clear.

What starts a record? it is unclear if what you posted is one string that you just formatted on two lines here, if it comes in as as single string with a newline character in it, or if you have two separate strings. Further, are you only doing this once, or is there a file with dozens or hundreds of strings you need to parse?

if you can give us some more details, people can guide you better.

Finally, what happened when you used substring? why didn't it work? What did it give you, and what were you expecting?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic