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
%%[ | |
/* pull the field to be masked from a data extension */ | |
set @text = AttributeValue("email") | |
/* check the length of the string */ | |
set @length = Length(@text) | |
/* count the number of characters to mask. | |
it also controls how many characters will not be masked. | |
currently set to 2, change to more if needed */ | |
set @subtract = subtract(@length,2) | |
/* extract the string to be masked */ | |
set @substring = Substring(@text,2,@subtract) | |
/* prepare a string of asterisks with the same length */ | |
for @i = 1 to @length do | |
set @asterisks = concat(@asterisks,"*") | |
next @i | |
/* replace content of the original string with asterisks */ | |
set @maskedText = replace(@text, @substring, @asterisks) | |
]%% | |
%%=v(@maskedtext)=%%<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment