I want to replaces backslashes from a string. example. the string "the\man\is\45\years\of\age" must be changed to "the/man/is/45/years/of/age" substring,substr,charAt ... etc are not working. How to do it. The string is a file path coming from an xml file. Thanks Ashu.
If your path only contains one slash, that slash and the next character following it will be interpreted as a special character. For example, \t would be a tab, \n would be a newline, etc. So the question is this: do you have any control over the creation of the XML string? If not, I think you may be hosed. If so, create your file path using \\ instead of \.
yes bodie, thats exactly what happens. c:\test is of length 6 and not 7. it seems that nothing can be done if the string has been coded wrongly. till now i haven't been able to figure out a way to deal with this. would welcome more brains to enter into this unseemingly tricky problem.
well you can play with this line TheStr=TheStr.split("X").join("Y"); where TheStr is the string that you have X would be the character(s) you would want to replace Y would be the character(s) that would replace the X Hope you understand what I was trying to say.
This is my favorite show. And this is my favorite tiny ad: