minWith

Returns the first character having the smallest value according to the provided comparator.

@JvmName(name = "minWithOrThrow")fun CharSequence.minWith(comparator: Comparator<in Char>): Char(source)
val text = "kotlin"
val smallest = text.minWith(Comparator { a, b -> a.compareTo(b) })
println("Smallest character: $smallest")  // Output: Smallest character: i

Source