splitTwice

fun String.splitTwice(removedDelimiter: String = ".", keptDelimiter: String = "["): List<String>(source)

Splits a string given those delimiters. removedDelimiter is removed after splitting, whereas keptDelimiter is kept around.

For example, if we split this[0].thing we get back listOf("this", "[0]", "thing").