public static java.lang.String | filter(java.lang.String input)Encode '<', '>', '"', '&' characters to their html equivalent
if (input == null)
{
return null;
}
else
{
StringBuffer filtered = new StringBuffer(input.length() * 2);
char c;
for (int i = 0; i < input.length(); i++)
{
c = input.charAt(i);
switch (c)
{
case '<":
filtered.append("<");
break;
case '>":
filtered.append(">");
break;
case '"":
filtered.append(""");
break;
case '&":
filtered.append("&");
break;
default:
filtered.append(c);
break;
}
}
return filtered.toString();
}
|