Coverting Decimal code to Char(For Html Chartacter)

HI ,allI want to replece all Decimal code to Char.E.g for& # 047; replace by / I have to replace all such code into chaacter from String.PLz give me quick soln ......ThanksMessage was edited by: OnlyForJava
[266 byte] By [OnlyForJavaa] at [2007-11-27 8:49:11]
# 1

import java.util.regex.*;

public class Test

{

public static void main(String... args)

{

System.out.println(unescapeHTML("this/that"));

}

public static String unescapeHTML(String str)

{

Pattern p = Pattern.compile("&#(\\d+);");

Matcher m = p.matcher(str);

StringBuffer sb = new StringBuffer();

while (m.find())

{

m.appendReplacement(sb, "");

sb.append((char)Integer.parseInt(m.group(1)));

}

m.appendTail(sb);

return sb.toString();

}

}

uncle_alicea at 2007-7-12 20:57:57 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks. It works fine
OnlyForJavaa at 2007-7-12 20:57:57 > top of Java-index,Java Essentials,Java Programming...