obfuscate

fun String.obfuscate(freq: Int = 2): String

Obfuscates this String by replacing characters at every freq-th position with '*'.

Positions count code points, so a surrogate pair (such as an emoji) is replaced or kept as a whole.

Return

the obfuscated string

Parameters

freq

the replacement frequency (default every 2nd character, starting at index 0)

Throws

if freq is not positive (it is used as a modulus divisor).