trimString.js
Gets rid of whitespace on either side of a string and returns a new string. For example, trimString(" abc ") will result in "abc".
// https://stackoverflow.com/a/3084733/5071723
function trimString(str) {
return str.replace(/^\s+|\s+$/g, "");
}
This site is open source. Improve this page ยป