Skip to Content »

FlashApe » Huh?

 Huh?

  • March 7th, 2007
  • 12:27 pm
Actionscript:
  1. 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(""));

5 People had this to say...

Gravatar
  • Bob
  • March 7th, 2007
  • 1:01 pm

Whats the problem? :)

The brackets are unnecessary but split/join is an easy way to find/replace in a string.

Gravatar
  • chuck
  • March 7th, 2007
  • 1:34 pm

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.

Gravatar

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 :)

Gravatar
  • John
  • March 7th, 2007
  • 1:46 pm

A convoluted way to remove all newline, carriage returns and html tags from a string?

Gravatar

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. :)

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>