function txtAlphaNumericFilter(data) {
/* This function ensures that only alpha-numeric characters, dashes and whitespace are present */
data = data.replace(/^\s+|\s+$/, '');
data = data.replace(/[^a-zA-Z0-9\-\s]/g, '');
return data;
}
function txtRemoveWhitespace(data) {
/* This function removes leading and trailing whitespace */
data = data.replace(/^\s+|\s+$/, '');
return data;
}
function txtSwapWhitespace(data) {
/* This function swaps out whitespace with a dash and also converts case to lower */
data = data.replace(/\-\-/g, '-');
data = data.replace(/\s+/g, '-');
data = data.toLowerCase();
return data;
}
function txtStringCap(data) {
/* Capitalize the first letter of each word */
return data.toLowerCase().replace(/\b./g, function(a) { return a.toUpperCase(); });
}
function txtNumbersAndCommas(data) {
/* This function filters out everything except for numbers and commas */
data = data.replace(/[^,0-9]/g, '');
return data;
}