Thursday, 4 July 2019

How to remove Escape sequence from String?

How to remove Escape sequence from String? There are many ways to remove escape sequence from bulky string, specially I like to use RegEx from java side. public class Test { public static void main(String[] args) { String s = "\n\n\tabcdtest"; String result = new Test().removeEscapeChars(s); System.out.println("RESULT::"+result); } private String removeEscapeChars(String finalString) {         Matcher matcher = Pattern.compile("\\&([^;]{6})", Pattern.CASE_INSENSITIVE).matcher(finalString);  ...