3 Replies Latest reply on Jan 2, 2009 5:20 AM by Newsgroup_User

    replace double slashes with single slash?

    chrisatflash Level 1
      Hello, does someone know how to remove double slashes and replace them with a single slash?

      I once got this answer, but it did not work:

      function replaceSlash(origText) {
      return origText.split("\").join("");
      }

      For example i got a string variable:
      var hello:String = "Hello world\nThis is on the second line";

      if you apply this string to a textfield you will see 2 sentence, because the \n is interpertated to a newline.

      But if you use loaded data, like onData (with flashvars) i noticed that the debug panel shows that the
      data is: Hello world\\n This is on the second line

      And in my external text file i dont have an extra backslash used.. so i don't know why the extra slash comes from, but i do know that i would like to remove it. Or that the \n wil be interpreted as escape characters.

      Does anyone know a fix for this?

      Regards,

      Micheal.