I have a string that I want to replace the ‘xx’ with a line break. I am writing this in a jsp page, just fyi. So for instance:
tmpString1 = "hello, how are youxxnice to meet you"
string1 = tmpString1.replace('xx', '<br />');
That explains what I would like to do. but I get an unclosed character literal error on this attempt, I have also tried:
tmpString1 = "hello, how are youxxnice to meet you"
string1 = tmpString1.replace('xx', '/n');
And this way it just replaces the ‘xx’ with a space, I know this seems trivial, but I cant seem to get it working. Thanks for the help.
It should be –
Note the double quotes for parameters in
replacemethod, as these is not character but String