How to replace all backslashes in a string with a pipe in Node.js

1 Answer

0 votes
let str = 'node.js\\c\\java\\';
 
str = str.replaceAll('\\', '|');
 
console.log(str);
     
     
     
     
/*
run:
     
node.js|c|java|
     
*/

 



answered Jul 2, 2022 by avibootz

Related questions

1 answer 120 views
1 answer 145 views
1 answer 124 views
1 answer 140 views
2 answers 140 views
...