aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Handling special charecters in java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Handling special charecters in java script" Watch "Handling special charecters in java script" New topic
Author

Handling special charecters in java script

AmitDBond Sethi
Greenhorn

Joined: Jun 06, 2008
Posts: 11
Hi,

I want to handle the special characters in java script.
Actually I am getting a string which will have the characters like < or
> or \ .
I would like to convert them into < or > or \\ respectively.
I am trying to search a generic library function which can do this for me.
A simple thing is what I can do is to use string.replace("\", "\\");
But i dot want to do that, I need a generic function which can handle all of these special chars in one function call.

Could and one please help me out.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

There isn't a builtin one. You'll need to write one yourself.
[ August 05, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
AmitDBond Sethi
Greenhorn

Joined: Jun 06, 2008
Posts: 11
Hi,

My Last post was a bit unclear, so posting again, please ignore the space after & sign while reading, as i knowingly added that space so that it does not convert the & lt; to < sign.

I want to handle the special characters in java script.
Actually I am getting a string which will have the characters like & lt; or
& gt; or & #092;
I would like to convert them into < or > or \ respectively.
I am trying to search a generic library function which can do this for me.
A simple thing is what I can do is to use string.replace("& #092;", "\");
But i dot want to do that, I need a generic function which can handle all of these special chars in one function call.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

I understood your question completely. The answer remains the same.
AmitDBond Sethi
Greenhorn

Joined: Jun 06, 2008
Posts: 11
Oh is it. In that case I will go ahead and write my own function.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling special charecters in java script