| Author |
String function to enclose a word in quotes
|
Sangeetha Verkot
Greenhorn
Joined: Jun 07, 2007
Posts: 4
|
|
I need to search for a particular word that the user enters in a textfield and append either single or double quotes to it. e.g. mySearchField = StringUtils.replace(mySearchField, "xyz", "here I want to replace xyz with 'xyz' or "xyz" ); Is there a way to accomplish this? Thanks!
|
 |
Jeff Storey
Ranch Hand
Joined: Apr 07, 2007
Posts: 230
|
|
Sangeetha, You might want to consider using the replace method in the String class. So, something like: If you want to use single quotes, just put them in there like this: If you want to use double quotes, use the backslash as the escape character: Hope this helps, Jeff
|
Jeff Storey
Software Developer
[url]http://jeffastorey.blogspot.com[/url]
|
 |
Sangeetha Verkot
Greenhorn
Joined: Jun 07, 2007
Posts: 4
|
|
|
It worked..Thanks.
|
 |
 |
|
|
subject: String function to enclose a word in quotes
|
|
|