Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling special charecters in java script

 
AmitDBond Sethi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't a builtin one. You'll need to write one yourself.
[ August 05, 2008: Message edited by: Bear Bibeault ]
 
AmitDBond Sethi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood your question completely. The answer remains the same.
 
AmitDBond Sethi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh is it. In that case I will go ahead and write my own function.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic