How to remove line breaks from start and end of a string in TypeScript

1 Answer

0 votes
let str = '\ntypescript c c++ php\n';
 
str = str.trim();
 
console.log(str);
 
   
   
   
   
/*
run:
   
"typescript c c++ php" 
   
*/

 



answered Apr 27, 2022 by avibootz
...