Here you can find the source of ConvertHexToUnicode(String hexCode)
Parameter | Description |
---|---|
hexCode | String Hex Code representation |
public static String ConvertHexToUnicode(String hexCode)
//package com.java2s; //License from project: Apache License public class Main { /**/*www . jav a 2 s . co m*/ * Method to convert Hex representation to Unicode using Linear Scan * @param hexCode String Hex Code representation * @return String Unicode text */ public static String ConvertHexToUnicode(String hexCode) { String toRet = "", nums = ""; boolean flag = false; StringBuilder token = new StringBuilder(); char[] ch = hexCode.toCharArray(); for (int i = 0; i < ch.length; i++) { if (ch[i] == '&') { flag = true; } /** Updating the Chain */ if (flag) { token.append(ch[i]); if (ch[i] == ';') { nums = token.toString().substring(2, token.toString().indexOf(";")); try { toRet += (char) Integer.parseInt(nums); } catch (Exception e) { toRet += token; } flag = false; token.setLength(0); } } else { toRet += ch[i]; } } return toRet.trim(); } }