Question #9
Submitted by Answiki
on 04/29/2020 at 05:55:05 PM UTC
In JS, how to remove carriage return from string?
Merged questions
Answer
Submitted by Answiki
on 04/29/2020 at 05:54:48 PM UTC
In JavaScript, to remove carriage return from string, use the following regex str.replace(/[\n\r]/g, ''); as on the following example :
var str="abc \n def \r ghi";
// Should change str for "abc def ghi"
str.replace(/[\n\r]/g, '');
Question by Answiki 04/29/2020 at 05:55:05 PM
In JS, how to remove carriage return from string?
Answer by Answiki on 04/29/2020 at 05:54:48 PM
In JavaScript, to remove carriage return from string, use the following regex str.replace(/[\n\r]/g, ''); as on the following example :
var str="abc \n def \r ghi";
// Should change str for "abc def ghi"
str.replace(/[\n\r]/g, '');
Question by Answiki 04/29/2020 at 05:51:12 PM
In Javascript, how to remove carriage return from string?
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 12029 | en | https://en.ans.wiki/9/in-js-how-to-remove-carriage-return-from-string | 8 |
Icons proudly provided by Friconix.