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 146 views
1 answer 142 views
1 answer 132 views
1 answer 131 views
1 answer 134 views
...