How to Remove http:// or https:// from a URL in TypeScript

1 Answer

0 votes
function removeHttp_s(url : string ) : string {
  	return url.replace(/^https?:\/\//, '');
}


console.log(removeHttp_s('https://seek4info.com'));

console.log(removeHttp_s('http://seek4info.com'));

  
  
  
  
/*
run:
  
"seek4info.com" 
"seek4info.com" 
  
*/

 



answered Apr 27, 2022 by avibootz

Related questions

1 answer 144 views
1 answer 139 views
1 answer 165 views
2 answers 246 views
1 answer 179 views
2 answers 207 views
...