AS split \

Out of context: Reply #1

  • Started
  • Last post
  • 4 Responses
  • Solid0

    The "\" slashes in a windows path act as escape sequences. You have 2 options here (AFAIK), depending on how your obtaining/generating your path:

    1/ Just use "/" slashes instead, so "C:\Windows" becomes "C:/Windows"

    2/ or if you have to use "\", then for every "\" you need to add a "\" to escape it, so:

    var path = "C:\Windows\Fonts";

    becomes

    var path = "C:\\Windows\\Fonts";

    then you can split it like this:

    var a = path.split("\u005c");

    where "\u005c" is the unicode equivalent of "\"

    HTH

View thread