String str = "=123-abc= =7890-ABCD=";
Pattern pattern = Pattern.compile("=([0-9]*)-([A-Za-z]*)=");
Matcher matcher = pattern.matcher(str);
if (matcher.find())
{
str = matcher.replaceAll("# $2 + $1 #");
}
System.out.println(str);
The output will be:
# abc + 123 # # ABCD + 7890 #
Tuesday, September 3, 2019
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment