formatInGroups

fun String.formatInGroups(groupSize: Int = 4, separator: String = "-"): String

Splits this string into equally sized groups and joins them with separator.

The final group may contain fewer than groupSize characters.