[as2]- removing/truncating Double Quotes (" 's)

Good Day All! Im working with some XML that has double quotes around the text that i want to work with. For example- “Miami” and I would like it to look like- Miami
This is what i was working with so far (but doesn’t work)

txt = “Miami”;
var dirtyTextArry:Array = txt.split(""");
var cleaned:String = dirtyTextArry[dirtyTextArry.length-1];
trace (cleaned);

whats the best way to accomplish this??

I don’t get what you’re trying to do. Your txt string has no double quotes in it.

sorry, i typed it vaguely… the txt is litterally “Miami” and i want it to be Miami

i think that would be txt = ““Miami””;

var txt:String = txt = "\"Miami\"";
trace(txt.substring(1, txt.length - 1));

you were on the right path with splitting it. now you just have to join it…


txt = "\"Miami\"";
txt = txt.split("\"").join("");

doh!! many thanks TheCanadian and jakattak… I have 2 books, but couldn’t find it in either. have a great weekend all!