I’m getting a result from a server where items are separated with new lines, so I do a:
split('\n');
split('\\n');
It doesn’t work! the \ disappears while debugging on Chrome (I see split(‘n’)).
How to make it work?
Sample data (copy from debugger of chrome):
“יופי וקוסמטיקה|10↵בידור ותרבות|9↵לילד ולתינוק|3↵תיירות|4↵תכשיטים|5”
If the result has the literal characters
"\n"in it, you need to escape your\.Another possibility is that you have
\r\nsequences in the string. If so, do this:…although the
.split('\n')should still work.Or if it is sending them with just
\rsequences, you’d do:If you’re not sure, do this: