programming-examples/js/String/Parameterize a string.js

4 lines
198 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
string_parameterize = function (str1) {
return str1.trim().toLowerCase().replace(/[^a-zA-Z0-9 -]/, "").replace(/\s/g, "-");
};
console.log(string_parameterize("Robin Singh from USA."));