Christopher Schene
asked on
How do I extract a number from a Java string?
I have the following string in Java:
"Send data to port 2112 with this entire message intact"
What is a good way to extract the number from the string and place "2112" in an integer?
I know some "brute force or hard" ways to do this but I am looking for something that uses good Java programming techniques.
What I am actually doing here is testing that ports are available---so i send a message to a server on port 2112 and tell it to send me back the same message on the specified port.
"Send data to port 2112 with this entire message intact"
What is a good way to extract the number from the string and place "2112" in an integer?
I know some "brute force or hard" ways to do this but I am looking for something that uses good Java programming techniques.
What I am actually doing here is testing that ports are available---so i send a message to a server on port 2112 and tell it to send me back the same message on the specified port.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fast response!
Good Answer....
:)
ASKER