N
nooneinparticular314159
I'm trying to obtain an integer from the beginning of a string. The
integer is of arbitrary length, followed by a delimiter, followed by
the rest of a string (which I need to preserve to do further parsing
on. ie, if ; is the delimiter, then the string might look like:
3;sometext or 342;sometext
To make things worse, the leading integer might not be an integer - it
might be a letter that I need to recognize as a delimiter.
So what I want to to do is identify that the leading part of the
string is in fact an integer, at which point I can split the string on
the delimiter and continue parsing. I've tried to use
Integer.getInteger:
Integer TestInteger = Integer.getInteger((InputString.substring(0,
1)));
But this returns null for some reason, even when run on an integer (as
a string).
How can I correctly identify that there is an integer here?
Thanks!
integer is of arbitrary length, followed by a delimiter, followed by
the rest of a string (which I need to preserve to do further parsing
on. ie, if ; is the delimiter, then the string might look like:
3;sometext or 342;sometext
To make things worse, the leading integer might not be an integer - it
might be a letter that I need to recognize as a delimiter.
So what I want to to do is identify that the leading part of the
string is in fact an integer, at which point I can split the string on
the delimiter and continue parsing. I've tried to use
Integer.getInteger:
Integer TestInteger = Integer.getInteger((InputString.substring(0,
1)));
But this returns null for some reason, even when run on an integer (as
a string).
How can I correctly identify that there is an integer here?
Thanks!