We can either loop through the string character by character until we replace all hyphens,
or we can create a regular expression as follows:
var myStr = 'This-is-a-test';Where g represents a global match.
var replacedString = myStr.replace(/-/g, ' ');
No comments:
Post a Comment