Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
Huh?
Actionscript:
-
textdata:String = ((((((settings.contact_extra.split("\r\n").join("")).split("\t").join(" ")).split("\n").join("")).split("<p>").join("")).split("</p>").join("").split("<b>").join("")).split("</b>").join(""));
| Print article | This entry was posted by rich on March 7, 2007 at 12:27 pm, and is filed under flash. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 3 years ago
Whats the problem?
The brackets are unnecessary but split/join is an easy way to find/replace in a string.
about 3 years ago
Gross. I get the gist of what it's meant to do, but eeeeew.
I think I should save this snippet to show to anyone who complains that regular expressions are hard to understand. A regex for this would be much more readable.
about 3 years ago
I can hardly read that... but it seems like the user is stripping out all white space (except for tabs) and some tags and then joining it back into one giant string with no line breaks... looks like a big bowl of 'wrong' to me
about 3 years ago
A convoluted way to remove all newline, carriage returns and html tags from a string?
about 3 years ago
that's pretty much what you have to do in as2 before. as3 has replace and regex. but i would never string them all together in a single line like that.