Link to home
Start Free TrialLog in
Avatar of singh101
singh101

asked on

Stripping characters from begining and end of a string

I want to remove numbers only from the begining of a string and the end of a string

1TestUser12324" -> "TestUser"
12Test3User12324" -> "Test3User"

How could this be done?

Many thanks
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
More concise:

s = s.replaceAll("^\\d+|\\d+$", "");

Open in new window

:)