J
Jochen Brenzlinger
Assume I have a String var and value like:
String var = new String("foobar[345]");
Now I want to check if this string matches a certain pattern and if yes extract the number into a long var.
The first part is easy:
if var.matches("\\w*\[\\d+\]") {
long l = ????; }
....but I have no idea on how to extract the number.
How can this be achieved?
Jochen
String var = new String("foobar[345]");
Now I want to check if this string matches a certain pattern and if yes extract the number into a long var.
The first part is easy:
if var.matches("\\w*\[\\d+\]") {
long l = ????; }
....but I have no idea on how to extract the number.
How can this be achieved?
Jochen