I have a string "123.0"
and use "123.0".matches( "(\\.)?0*$" )
to check if it has any trailing zeros but it does not match. The same regexp matches string correctly @ http://regexpal.com/
How about if I want to just replace the last zeros with something else. String.replace says:
replace(CharSequence target, CharSequence replacement) - Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
But "123.0".replace( "(\\.)?0*$", "" )
it will not replace the last ".0".