8

Are there any functions available to convert:

Me, Myself & I

to

Me, Myself & I

I can't find anything in the Flex documentation.

Thanks.

3 Answers 3

9

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

It's worth noting: I believe this is AS2.
Well, escaping XML isn't exactly escaping HTML For instance I would like \n to be converted into <br>.
3

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/

Comments

-4

Escape should do it:

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

1 Comment

escape() does URL encoding, not HTML encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.