Last active
August 5, 2019 16:55
-
-
Save pjmartorell/4e0705f5382f32ee81b3d349229a1e38 to your computer and use it in GitHub Desktop.
Mask phone with asterisks except last 3 characters
This file contains hidden or 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
phone = '+36637950242'; phone[0..-4] = '*' * phone[0..-4].length; phone | |
# OR | |
phone = '+36637950242'; phone.gsub(/.(?=.{3})/,'*') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment