Created
April 15, 2019 13:57
-
-
Save chrismaddalena/b8ec02ee573633e136ba78cd6eb3957c to your computer and use it in GitHub Desktop.
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
def sanitize(string): | |
"""Sanitize the provided string by replacing chunks with asterisks.""" | |
sanitized_string = string | |
length = len(string) | |
if length == 32: | |
sanitized_string = string[0:4] + "*"*(length-8) + string[length-5:length-1] | |
elif length > 2: | |
sanitized_string = string[0] + "*"*(length-2) + string[length-1] | |
return sanitized_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment