Java examples for java.lang:String Unicode
unicode To String via Regex
/**/* www . j a va2 s.com*/ * Copyright (c) 2010-2016. by Liuxuan All rights reserved. <br/> * *************************************************************************** * YYYY-MM-DD | Author | Change Description * 2016/3/9 | Moses | Created */ //package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String unicodeToString(String str) { Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))"); Matcher matcher = pattern.matcher(str); char ch; while (matcher.find()) { ch = (char) Integer.parseInt(matcher.group(2), 16); str = str.replace(matcher.group(1), ch + ""); } return str; } }