Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class to Encode a string for a url

 
Adam Dear
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know where I might find a class that will convert a normal string into one that is formated for a url? What I mean is if I pass it a string:

This is a string

I want it to return:

This+is+a+string

so that I can append this to a url in an anchor tag which is generated through a servlet, bean, jsp or whatever.

Thanks
-A
 
Dave Robbins
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works for me

http://www.rgagnon.com/javadetails/java-0084.html
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic