tags:

views:

102

answers:

1

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 didn't work.

Or do i have to implement it?

Thanks.

+4  A: 

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

RodeoClown
it worked! thanks a lot.
firnnauriel
Excellent, glad to help! :)
RodeoClown