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 122 views
1 answer 145 views
1 answer 127 views
1 answer 144 views
2 answers 141 views
...