Wednesday, October 2, 2013

Ez way to mask value in peoplecode

You can use this one line of code to mask sensitive data such as social security, bank account, etc.

Local string &_value = "123456789"; 
Local string &_masking_char = "*"; /* masking character */
Local integer &_digit_display = 4; /* number to display */
Local string &_new_value;

&_new_value = Rept(&_masking_char, Len(&_value) - &_digit_display) | Substring(&_value, (Len(&_value) - &_digit_display) + 1, Len(&_value));

Result:
&_new_value is *****6789


No comments:

Post a Comment