Skip to content

Instantly share code, notes, and snippets.

@cdale77
Created April 19, 2014 06:10
Show Gist options
  • Save cdale77/11075646 to your computer and use it in GitHub Desktop.
Save cdale77/11075646 to your computer and use it in GitHub Desktop.
OpenRefine functions
## Remove common characters from phone numbers.
value.replace("-","").replace(".","").replace("-","").replace("(","").replace(")","").replace(" ","")
## Takes phone numbers formatted as 5555555555 and formats them as 555-555-5555
value.slice(0,3) + "-" + value.slice(3,6) + "-" + value.slice(6,10)
## add zeros to the front of zip codes. Useful for when Excel removes them.
"000000"[0,10-value.length()] + value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment