programming-examples/js/String/Parameterize a string.js
2019-11-15 12:59:38 +01:00

4 lines
198 B
JavaScript

string_parameterize = function (str1) {
return str1.trim().toLowerCase().replace(/[^a-zA-Z0-9 -]/, "").replace(/\s/g, "-");
};
console.log(string_parameterize("Robin Singh from USA."));