How to replace all backslashes in a string with a pipe in TypeScript

1 Answer

0 votes
let str = 'typescript\\c\\php\\';

str = str.replaceAll('\\', '|');

console.log(str);
    
    
    
    
/*
run:
    
"typescript|c|php|"  
    
*/

 



answered Jul 2, 2022 by avibootz

Related questions

1 answer 114 views
1 answer 122 views
1 answer 132 views
2 answers 159 views
...