Yeti
Yeti

Reputation: 5818

How to eat HTML tags?

Is there any function that converts

<a href="test.php"/>

to

&lt; href=&quot;test.php&quot;/&gt;

It would be helpful if all html characters were converted in the similar manner.

Is there a function or library to do this?

Upvotes: 0

Views: 270

Answers (3)

Delan Azabani
Delan Azabani

Reputation: 81482

var eaten:String = myString.replace(/&/g,'&amp;').
                            replace(/</g,'&lt;').
                            replace(/>/g,'&gt;').
                            replace(/"/g,'&quot;');

Upvotes: 2

Andrew
Andrew

Reputation: 4624

It sounds like encodeURIComponent may be what you're after:

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/package.html#encodeURIComponent%28%29

Upvotes: 0

jaysonragasa
jaysonragasa

Reputation: 1076

use HttpUtility

Upvotes: 0

Related Questions