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 117 views
1 answer 142 views
1 answer 121 views
1 answer 135 views
2 answers 134 views
...