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 211 views
1 answer 239 views
1 answer 210 views
1 answer 244 views
2 answers 266 views
...