+ 8
How to parse Number in java?
I want to know how to parse a number from a string without parsing it as any specific type of number(i.e not as an integer, long, double or float) but just as a number. For example: String num = "99.34"; Object number = Number.parseNumber(num); Is there any function lyk that?
4 Réponses
+ 7
@Yerucham : Sorry for that, but I did understand it from your question. Maybe you were trying to ask somethin' else. Thank you @Taylor :))
+ 6
I don't tink my question is understood, I want a function that will parse a string a give a double if d string is a double and an int if d string is an int
+ 6
thank u Taylor
+ 3
@Martin Taylor it's is possible
When you get the string look into the content of the string and choose what type you want for it?
You can peep at string with regExp or just getChars() method.