Encode HTML in Flex/Actionscript

落花浮王杯 提交于 2019-12-19 16:33:08

问题


Are there any functions available to convert:

Me, Myself & I

to

Me, Myself & I

I can't find anything in the Flex documentation.

Thanks.


回答1:


Check this out. No swc's to include. Basically it's

var s:String = new XMLNode(3, "Me, Myself & I").toString();




回答2:


Here's the AS3 solution:

import flash.xml.XMLNode;
import flash.xml.XMLNodeType;

public function htmlEscape(str:String):String {
    return XML( new XMLNode( XMLNodeType.TEXT_NODE, str ) ).toXMLString();
}

Source: http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/




回答3:


Escape should do it:

http://livedocs.adobe.com/flex/201/langref/package.html#escape%28%29



来源:https://stackoverflow.com/questions/2342453/encode-html-in-flex-actionscript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!