开发者

How to implement javascript's 'escape' function in grails

开发者 https://www.devze.com 2022-12-30 00:18 出处:网络
Is there an equivalent of JS \'escape\' function in Groovy/Java? escape(\'hello world\') => hello%20world

Is there an equivalent of JS 'escape' function in Groovy/Java?

escape('hello world') => hello%20world

I tried this class: http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html, but it did开发者_高级运维n't work.

Or do i have to implement it?

Thanks.


Try the UrlEncoder class. I.E - URLEncoder.encode 'hello world'

0

精彩评论

暂无评论...
验证码 换一张
取 消