bu zhidao. just googled. because of reg expression bah. I needed same code couple of weeks ago and just wrote a function for it.
【在 w***y 的大作中提到】 : thx! 为啥需要这么多\\\\呢? hehe
T*e
5 楼
I guess what you need is String.replace("'", "\\'"), instead of replaceAll() No regular expression is necessary. You must be doing SQL statements, hehe.
【在 T*****e 的大作中提到】 : I guess what you need is String.replace("'", "\\'"), instead of replaceAll() : No regular expression is necessary. : You must be doing SQL statements, hehe.
T*e
7 楼
Generating JavaScript using Java? Enn... I did do something like populating initial values for JavaScipt variables in JSPs. :)
【在 g*s 的大作中提到】 : : javascript ye shi you keneng de ya. hehe.
g*y
8 楼
1. Java compilor need \\ to know that you want a \. 2. regexp need \\ to know that you want a \. That's why you need \\\\ to get actually one \. similarly, if you want a ".", you need to put "\\\."