masked

fun String?.masked(maskChar: Char = '*'): String?(source)

Returns string with masked symbols using the strictest security level.

This method is designed for masking sensitive secrets and provides maximum security by returning a consistent pattern that reveals no information about the original content.

Examples:

  • null ->null

  • "" ->null

  • " " ->null

  • "I" ->"***HIDDEN***"

  • "Hi" ->"***HIDDEN***"

  • "Hello" ->"***HIDDEN***"

  • "VeryLongSecretKey123" ->"***HIDDEN***"