Subject Re: [firebird-support] Escape Character for apostrophe?
Author Niki Ivanchev
public String escape(String s) {
if (s == null) {
return "";
}
String retvalue = s;
if (s.indexOf("'") != -1) {
StringBuffer hold = new StringBuffer();
char c;
for (int i = 0; i < s.length(); i++) {
if ( (c = s.charAt(i)) == '\'') { // backslashed apostrophe here
hold.append("''"); // two apostrophes here
}
else {
hold.append(c);
}
}
retvalue = hold.toString();
}
return retvalue;
}

Regards
Niki


barfingdog_2004 wrote:

>Hi Folks:
>
> Thanks to all of you, I'm now having a good
>time developing with IBPP using the embedded
>server.
>
> How do you escape an apostrophe, so it can be
>part of the text in an insertion operation?
>
> I can read articles on the support news server
>mirror, but I have to go through Yahoo's inferior
>interface (no spell checker, no indentation when
>reading posts, no grouping with stepped
>indentation of related posts) in order to post.
>Can I post directly to the new server mirror? I
>haven't had any luck.
>
> Thanks
> Larry
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>