Created
April 19, 2014 06:10
-
-
Save cdale77/11075646 to your computer and use it in GitHub Desktop.
OpenRefine functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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