View Full Version : convert "C:\Windows" to "C:/Windows"
i think there is No way to do so :eek: :eek: :eek:
trace("\a" == "\e");
//true
trace("\a" == "\f");
//false
trace("\a" == "\g");
//true
http://www.actionscript.org/forums/showthread.php3?p=435288#post435288
Data is coming from a server !
Headshotz
01-12-2006, 06:41 AM
:eek:
var str_A = "C:\Program\textfile.txt";
if (str_A == "C:\Program\textfile.txt") {
var str_A = "C:\\Program\\textfile.txt";
}
var str_B = str_A.split("\ ").join("/");
trace(str_A+" = A");
trace(str_B+" = B");
Maybe only the doubleslash will work :confused:
Flash Gordon
01-12-2006, 07:12 AM
can you turn this into a while()
var str:String = "C:\Program\textfile.txt";
//while (str.indexOf("\\") != -1) {
var num1 = str.indexOf("\\");
var sub_str1 = str.slice(0, num1);
sub_str1 += "/";
str = str.slice(num1, str.length);
trace(str);// \rogram extfile.txt <<---Miss the characters is where the problem becomes.
trace(sub_str1);C:/
//}
var str:String = "C:\Program\textfile.txt";
trace( str.split("")) // C,:,\,r,o,g,r,a,m, ,e,x,t,f,i,l,e,.,t,x,t
Acutally, the \ excapes the letter after it. So it appears there really is not way.
And why is this false, while the rest are true?
trace("\a" == "\f");
Headshotz
01-12-2006, 07:16 AM
confused = true;
Hehe, developers crappy joke :p
JEBoothjr
01-12-2006, 02:08 PM
trace("\a" == "\f");
this returns false because \f is a code for a "form feed" similar to \n for a new line or \t for a tab.
Headshotz
01-15-2006, 09:25 AM
Hum, it seems we are doomed!
astgtciv
01-20-2006, 02:47 AM
What does "data coming from the server" mean exactly here? Surely, this must be different than simply writing the data out in a string to be compiled down into a swf. When that is done, it seems that during the compilation process "\x" (where 'x' is a letter - A, b, p, etc.) is interpreted as an escape code. Some of those escape codes mean something (e.g., "\n" will get compiled down to a newline (ASCII Code 10), most don't mean anything (e.g. "\a") - and will simply be replaced by the "\" character. But if the data is "coming from the server", then it must already be coming as valid character data, and doing str.split("\\").join("/") would replace all the "\" characters by "/"... This is not the same as writing out var strA="C:\Program Files\etc" in Studio and then compiling it, right?
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.