Friday, July 6, 2012

How to print text from string of HTML decimal entity in Java?


Below is the Code..........


String encodeString="सड्फलक्ल क्लजकलसदफ  क्ळज्सलड्फ";



 StringBuffer sb = new StringBuffer();
   Matcher m = Pattern.compile("\\&#(\\d+);").matcher(s);
   while (m.find()) {
       int uc = Integer.parseInt(m.group(1));
       m.appendReplacement(sb, "");
       sb.appendCodePoint(uc);
   }
   m.appendTail(sb);



System.out.print(sb.toString());


OUTPUT :
सड्फलक्ल क्लजकलसदफ  क्ळज्सलड्फ

No comments:

Post a Comment