GraphMine

graphmine-util / io.github.sof3.graphmine.util.string / FormattedStringReader / exactly

exactly

fun exactly(vararg oneOf: String, suffix: String = ""): String?

Returns the first value in oneOf that the remaining string starts with. Returns null if none is found.

If suffix is provided, each oneOf is appended with the suffix, but the suffix itself will not be returned.

Consumes both the matched oneOf value and the suffix.

The options are searched in order. If a greedy approach is desired, the caller should reverse-sort the args by length before passing.