Subject: Re: Java servlets & html escape codes.
From: "Ron Jon" <[EMAIL PROTECTED]>
===
that's one possible way to do conversion string-->html:
public static String ConvertString(String source){
if (source==null)
return null;
int length = source.length();
StringBuffer temp = new StringBuffer(2*length);
for(int i=0;i<length;i++){
char c = source.charAt(i);
if (c =='<') temp.append("<");
else if (c =='>') temp.append(">");
else if (c =='&') temp.append("&");
else if (c =='"') temp.append(""");
else if (c ==' ') temp.append(" ");
else temp.append(c);
}
return temp.toString();
}
"Anthony Geoghegan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Anyone know a low overhead class or method for converting text strings to
> html escape coded strings (and back again) for java Servlet
implementation?
>
> i.e. & --> &
> etc.
> Best Regards,
> Anthony Geoghegan.
> J2EE Developer
> CPS Ireland Ltd.
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>