Есть ли метод Kotlin, такой как Scala's Span, который объединяет Takehile и Dropwhile («Split»?), Но без дублированных усилий? < /p>
val foo = "111222111"
val prefix = foo.takeWhile { it == '1' } // "111"
val suffix = foo.dropWhile { it == '1' } // "222111"
// Is there a `span` method that returns both
// the matching prefix and the non-matching suffix
// with one call?
val (p, s) = foo.span { it == '1' }
Подробнее здесь: https://stackoverflow.com/questions/795 ... d-dropwhil
Есть ли метод Kotlin, такой как Scala's Spane, который сочетает в себе дубль и Dropwhile («Split»?) ⇐ Html
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение