Java examples for java.util.regex:Match Word
remove End Zero by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String removeEndZero(String text) { Pattern pattern = Pattern.compile(".0*$"); Matcher matcher = pattern.matcher(text); if (matcher.find()) { String replace = matcher.group(); return text.replace(replace, ""); }/*ww w. j ava 2s .c om*/ return text; } }