R
R
retyui2015-05-04 11:49:45
JavaScript
retyui, 2015-05-04 11:49:45

Splitting a string from a textarea into an array of strings with \n\r?

body-parser parses the textarea value, all into one line like:
"Строка1...\r\nСтрока...2\r\n"
Please, this is how I see it from under Windows.
and using split('\r\n') will be fine for win users.
Which method will be universal for all platforms and OS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2015-05-04
@retyui

var s = "Строка1...\r\nСтрока...2\r\n";
var lines = s.split(/\r?\n/);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question