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
singh101Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Try
s = s.replaceAll("^\\d+", "").replaceAll("\\d+$", "");

Open in new window

0
 
CEHJCommented:
More concise:

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

Open in new window

0
 
CEHJCommented:
:)
0
All Courses

From novice to tech pro — start learning today.