Mask String

Mask a string showing only the last few characters, useful for credit cards or SSNs.

Code

Utilities
maskChar * (len(str) - visibleChars) + str[-visibleChars:]

Parameters

The string to mask.

Number of characters to show at the end.

Character to use for masking.

Server

More Python Snippets