-
cant use the backslash symbol "\" in my code
HI all
i have a line of code
countVar=myVar.lastIndexOf("\");
but i am not allowed to export the movie,
if i change the "\" to anything else the the movie is fine -
why is this, i need to use the "\" symbol as i am cutting up a string of a file path.
can i use anything else instead ??
many thanks in advance,
gilesb
-
Senior Member
\ is used as an escape character, for example you can use " inside a string like this,
var welcome = "someone says \"hello\"";
or a new line in some text like this,
var myString = "hello\nworld"; // adds a new line between words
In order to use the \ as a regular character in the string you need to escape it using another \
var myString = "something\\something else";
trace(myString.length); // the \\ only counts as a single character
trace(myString.indexOf("\\");
hope this helps
-
No!
the '\' character is used to escape other non-printable characters such as the newline '\n' carraige return '\r' null byte '\0' and so on. In order to use it, you must escape it, so the \ character is entered as '\\'.
-
No!
you're too fast for me catbert
-
Senior Member
-
Hi chaps
many thanks for that
gilesb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|