开发者

How to eat HTML tags?

开发者 https://www.devze.com 2022-12-29 00:02 出处:网络
Is there any function that converts <a href=\"test.php\"/> to &lt; href=&quot;test.php&quot;/&gt;

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 charact开发者_JS百科ers were converted in the similar manner.

Is there a function or library to do this?


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


use HttpUtility


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消