Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Created November 29, 2016 17:01
Show Gist options
  • Save JamoCA/dc4915d27d55063390557d839c2cfee5 to your computer and use it in GitHub Desktop.
Save JamoCA/dc4915d27d55063390557d839c2cfee5 to your computer and use it in GitHub Desktop.
ColdFusion UDF to trim, strip multiple spaces and remove undesireable space characters (non-breaking space, tab, line feed, carriage return)
function singleLine(s){
s = replacelist(s, "#chr(9)#,#chr(10)#,#chr(12)#,#chr(13)#,#chr(160)#", " , , , , ");
return trim(reReplace(s, "[[:space:]]{2,}", " ", "all"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment