I have a String
variable that I want to convert to a long
variable.
The problem is that the String variable will never contain any numbers, so simply calling Long.parseLong(myString);
will throw a NumberFormatException
.
To clarify my intentions:
I have a method that returns a long
from a String
in-parameter. I want the method to generate an ID based on the String
variable, to later be able to group the long
values.
I might solve this using a RegEx expression, but my question is if there's any straight forward way to get a long
value of a String
?