How to remove the first occurrence of comma from a string in TypeScript

1 Answer

0 votes
let str = 'c c++, typescript, python, php';
 
if (str.match(/,.*,/)) { 
    str = str.replace(',', ''); 
}
 
console.log(str);
 
   
   
   
   
/*
run:
   
"c c++ typescript, python, php" 
   
*/

 



answered Apr 16, 2022 by avibootz

Related questions

1 answer 148 views
1 answer 145 views
1 answer 137 views
1 answer 133 views
1 answer 137 views
...