Tuesday, 15 February 2011

java - Find substring between two strings -



java - Find substring between two strings -

i have string such as: file = "usertemplate324.txt"

i'd extract "324". how can without external libraries apache stringutils?

if want exclude non-digit characters:

string number = file.replaceall("\\d+", "");

\\d+ means series of 1 or more non digit (0-9) characters , replace such series "" i.e. nothing, leaves digits only.

java string

No comments:

Post a Comment