Answers for "replaceall in typescript"

2

replaceall typescript

public replaceAll(str: string, find: string, replace: string) {
	return str.replace(new RegExp(find, 'g'), replace);
}
Posted by: Guest on November-13-2021
6

replace string in typescript

var re = /apples/gi; 
var str = "Apples are round, and apples are juicy.";
var newstr = str.replace(re, "oranges"); 
console.log(newstr)
Posted by: Guest on April-02-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language