CTG said:
var test = "<SD><RI><XYYYY>";
stringOut("Before conversion"+test);
var x1= "><";
var x2= ">\r\n<";
test = test.replaceAll(x1,x2);
stringOut("After conversion"+test);
Yes sure it was a .. but now whats wrong with this
When you want others to help with a problem, you need to provide three
things:
1. What you did. The code is sufficient, but make sure that it is the
*exact* code that provokes the problem, and that all helper functions
and other environment is included. In this case, you didn't say what
stringOut was. We can guess, but we can be wrong. It's better to
replace it by "alert" if you know it isn't important.
And make sure the code runs (there is no replaceAll method on strings)!
2. What you expect to happen. This is completely missing.
3. What actually happens. This is missing too. We can try running your
code, but we won't know if what we see is what you see (e.g., the bug
could be in your browser).
Without that, at best we can guess, and at worst we won't bother
trying.
That said, I *guess* that you want to replace all instances of
"><" with ">\r\n<" in a string.
To replace more than the first instance, you should use a
regexp with the global flag to do the matching:
test = test.replace(/></g, ">\r\n<");
/L