Tattoued Posted September 5, 2014 Share Posted September 5, 2014 I need a rule for adding a hyphen to a +4 - I have separate columns for the zip code - the zip in one and the +4 in another. Some have the +4 and some don't. I need to add a hyphen to the ones that do have +4 but NO hyphen to the ones that don't. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 5, 2014 Share Posted September 5, 2014 If you have two separate fields: return [Field("ZIPCode"), Field("ZIPPlusFour")].filter(String).join('-'); If you only have one field: return Field("ZIPCode").replace(/^(\d{5})-?(\d{4})$/, "$1-$2"); Quote Link to comment Share on other sites More sharing options...
Tattoued Posted September 5, 2014 Author Share Posted September 5, 2014 Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.