{ <EOL> val modelHub = <EOL> ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val model = ONNXModels . CV . ResNet18 . pretrainedModel ( modelHub ) <EOL> model . printSummary ( ) <EOL> model . use { <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:8> ) { <EOL> val imageFile = getFileFromResource ( "<STR_LIT>" ) <EOL> val recognizedObject = it . predictObject ( imageFile = imageFile ) <EOL> println ( recognizedObject ) <EOL> val top5 = it . predictTopKObjects ( imageFile = imageFile , topK = <NUM_LIT:5> ) <EOL> println ( top5 . toString ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * This examples demonstrates the light-weight inference API with [ImageRecognitionModel] on ResNet'18 model:
 * - Model is obtained from [ONNXModelHub].
 * - Model predicts on a few images located in resources.
 */


= resnet18LightAPIPrediction ( )


@ ExperimentalEncodingApi <EOL> public fun Base64 . encodeToByteArray ( source : ByteString , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : ByteArray

{ <EOL> return encodeToByteArray ( source . getBackingArrayReference ( ) , startIndex , endIndex ) <EOL> }

/**
 * Encodes bytes from the specified [source] byte string or its subrange.
 * Returns a [ByteArray] containing the resulting symbols.
 *
 * If the size of the [source] byte string or its subrange is not an integral multiple of 3,
 * the result is padded with `'='` to an integral multiple of 4 symbols.
 *
 * Each resulting symbol occupies one byte in the returned byte array.
 *
 * Use [encode] to get the output in string form.
 *
 * @param source the byte string to encode bytes from.
 * @param startIndex the beginning (inclusive) of the subrange to encode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to encode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 *
 * @return a [ByteArray] with the resulting symbols.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . encodeIntoByteArray ( source : ByteString , destination : ByteArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : Int

{ <EOL> return encodeIntoByteArray ( source . getBackingArrayReference ( ) , destination , destinationOffset , startIndex , endIndex ) <EOL> }

/**
 * Encodes bytes from the specified [source] byte string or its subrange and writes resulting symbols into the [destination] array.
 * Returns the number of symbols written.
 *
 * If the size of the [source] byte string or its subrange is not an integral multiple of 3,
 * the result is padded with `'='` to an integral multiple of 4 symbols.
 *
 * @param source the byte string to encode bytes from.
 * @param destination the array to write symbols into.
 * @param destinationOffset the starting index in the [destination] array to write symbols to, 0 by default.
 * @param startIndex the beginning (inclusive) of the subrange to encode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to encode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException when the resulting symbols don't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 *
 * @return the number of symbols written into [destination] array.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . encode ( source : ByteString , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : String

{ <EOL> return encode ( source . getBackingArrayReference ( ) , startIndex , endIndex ) <EOL> }

/**
 * Encodes bytes from the specified [source] byte string or its subrange.
 * Returns a string with the resulting symbols.
 *
 * If the size of the [source] byte string or its subrange is not an integral multiple of 3,
 * the result is padded with `'='` to an integral multiple of 4 symbols.
 *
 * Use [encodeToByteArray] to get the output in [ByteArray] form.
 *
 * @param source the byte string to encode bytes from.
 * @param startIndex the beginning (inclusive) of the subrange to encode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to encode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 *
 * @return a string with the resulting symbols.
 */


@ ExperimentalEncodingApi <EOL> public fun < A : Appendable > Base64 . encodeToAppendable ( source : ByteString , destination : A , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : A

{ <EOL> return encodeToAppendable ( source . getBackingArrayReference ( ) , destination , startIndex , endIndex ) <EOL> }

/**
 * Encodes bytes from the specified [source] byte string or its subrange and appends resulting symbols to the [destination] appendable.
 * Returns the destination appendable.
 *
 * If the size of the [source] byte string or its subrange is not an integral multiple of 3,
 * the result is padded with `'='` to an integral multiple of 4 symbols.
 *
 * @param source the byte string to encode bytes from.
 * @param destination the appendable to append symbols to.
 * @param startIndex the beginning (inclusive) of the subrange to encode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to encode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 *
 * @return the destination appendable.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . decode ( source : ByteString , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : ByteArray

{ <EOL> return decode ( source . getBackingArrayReference ( ) , startIndex , endIndex ) <EOL> }

/**
 * Decodes symbols from the specified [source] byte string or its subrange.
 * Returns a [ByteArray] containing the resulting bytes.
 *
 * The symbols for decoding are not required to be padded.
 * However, if there is a padding character present, the correct amount of padding character(s) must be present.
 * The padding character `'='` is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.
 *
 * @param source the byte string to decode symbols from.
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IllegalArgumentException when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
 *
 * @return a [ByteArray] with the resulting bytes.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . decodeToByteString ( source : CharSequence , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . length ) : ByteString

{ <EOL> return ByteString . wrap ( decode ( source , startIndex , endIndex ) ) <EOL> }

/**
 * Decodes symbols from the specified [source] char sequence or its substring.
 * Returns a [ByteString] containing the resulting bytes.
 *
 * The symbols for decoding are not required to be padded.
 * However, if there is a padding character present, the correct amount of padding character(s) must be present.
 * The padding character `'='` is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.
 *
 * @param source the char sequence to decode symbols from.
 * @param startIndex the beginning (inclusive) of the substring to decode, 0 by default.
 * @param endIndex the end (exclusive) of the substring to decode, length of the [source] by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IllegalArgumentException when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
 *
 * @return a [ByteArray] with the resulting bytes.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . decodeIntoByteArray ( source : ByteString , destination : ByteArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : Int

{ <EOL> return decodeIntoByteArray ( source . getBackingArrayReference ( ) , destination , destinationOffset , startIndex , endIndex ) <EOL> }

/**
 * Decodes symbols from the specified [source] byte string or its subrange and writes resulting bytes into the [destination] array.
 * Returns the number of bytes written.
 *
 * The symbols for decoding are not required to be padded.
 * However, if there is a padding character present, the correct amount of padding character(s) must be present.
 * The padding character `'='` is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.
 *
 * @param source the byte string to decode symbols from.
 * @param destination the array to write bytes into.
 * @param destinationOffset the starting index in the [destination] array to write bytes to, 0 by default.
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException when the resulting bytes don't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 * @throws IllegalArgumentException when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
 *
 * @return the number of bytes written into [destination] array.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . decodeToByteString ( source : ByteArray , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : ByteString

/**
 * Decodes symbols from the specified [source] byte string or its subrange.
 * Returns a [ByteString] containing the resulting bytes.
 *
 * The symbols for decoding are not required to be padded.
 * However, if there is a padding character present, the correct amount of padding character(s) must be present.
 * The padding character `'='` is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.
 *
 * @param source the byte string to decode symbols from.
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of the [source] byte string by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] byte string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IllegalArgumentException when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
 *
 * @return a [ByteString] with the resulting bytes.
 */


@ ExperimentalEncodingApi <EOL> public fun Base64 . decodeToByteString ( source : ByteString , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size ) : ByteString

{ <EOL> return ByteString . wrap ( decode ( source . getBackingArrayReference ( ) , startIndex , endIndex ) ) <EOL> }


public expect fun CharSequence . elementAt ( index : Int ) : Char

/**
 * Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this char sequence.
 *
 * @sample samples.collections.Collections.Elements.elementAt
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . elementAtOrElse ( index : Int , defaultValue : ( Int ) -> Char ) : Char

{ <EOL> contract { <EOL> callsInPlace ( defaultValue , InvocationKind . AT_MOST_ONCE ) <EOL> } <EOL> return if ( index in indices ) get ( index ) else defaultValue ( index ) <EOL> }

/**
 * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.
 *
 * @sample samples.collections.Collections.Elements.elementAtOrElse
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . elementAtOrNull ( index : Int ) : Char ?

{ <EOL> return this . getOrNull ( index ) <EOL> }

/**
 * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence.
 *
 * @sample samples.collections.Collections.Elements.elementAtOrNull
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . find ( predicate : ( Char ) -> Boolean ) : Char ?

{ <EOL> return firstOrNull ( predicate ) <EOL> }

/**
 * Returns the first character matching the given [predicate], or `null` if no such character was found.
 *
 * @sample samples.collections.Collections.Elements.find
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . findLast ( predicate : ( Char ) -> Boolean ) : Char ?

{ <EOL> return lastOrNull ( predicate ) <EOL> }

/**
 * Returns the last character matching the given [predicate], or `null` if no such character was found.
 *
 * @sample samples.collections.Collections.Elements.find
 */


public fun CharSequence . first ( ) : Char

{ <EOL> if ( isEmpty ( ) ) <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> return this [ <NUM_LIT:0> ] <EOL> }

/**
 * Returns the first character.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


public inline fun CharSequence . first ( predicate : ( Char ) -> Boolean ) : Char

{ <EOL> for ( element in this ) if ( predicate ( element ) ) return element <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> }

/**
 * Returns the first character matching the given [predicate].
 * @throws [NoSuchElementException] if no such character is found.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Any > CharSequence . firstNotNullOf ( transform : ( Char ) -> R ? ) : R

{ <EOL> return firstNotNullOfOrNull ( transform ) ? : throw NoSuchElementException ( "<STR_LIT>" ) <EOL> }

/**
 * Returns the first non-null value produced by [transform] function being applied to characters of this char sequence in iteration order,
 * or throws [NoSuchElementException] if no non-null value was produced.
 *
 * @sample samples.collections.Collections.Transformations.firstNotNullOf
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Any > CharSequence . firstNotNullOfOrNull ( transform : ( Char ) -> R ? ) : R ?

{ <EOL> for ( element in this ) { <EOL> val result = transform ( element ) <EOL> if ( result != null ) { <EOL> return result <EOL> } <EOL> } <EOL> return null <EOL> }

/**
 * Returns the first non-null value produced by [transform] function being applied to characters of this char sequence in iteration order,
 * or `null` if no non-null value was produced.
 *
 * @sample samples.collections.Collections.Transformations.firstNotNullOf
 */


public fun CharSequence . firstOrNull ( ) : Char ?

{ <EOL> return if ( isEmpty ( ) ) null else this [ <NUM_LIT:0> ] <EOL> }

/**
 * Returns the first character, or `null` if the char sequence is empty.
 */


public inline fun CharSequence . firstOrNull ( predicate : ( Char ) -> Boolean ) : Char ?

{ <EOL> for ( element in this ) if ( predicate ( element ) ) return element <EOL> return null <EOL> }

/**
 * Returns the first character matching the given [predicate], or `null` if character was not found.
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . getOrElse ( index : Int , defaultValue : ( Int ) -> Char ) : Char

/**
 * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.
 */


public fun CharSequence . getOrNull ( index : Int ) : Char ?

{ <EOL> return if ( index in indices ) get ( index ) else null <EOL> }

/**
 * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence.
 *
 * @sample samples.collections.Collections.Elements.getOrNull
 */


public inline fun CharSequence . indexOfFirst ( predicate : ( Char ) -> Boolean ) : Int

{ <EOL> for ( index in indices ) { <EOL> if ( predicate ( this [ index ] ) ) { <EOL> return index <EOL> } <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns index of the first character matching the given [predicate], or -1 if the char sequence does not contain such character.
 */


public inline fun CharSequence . indexOfLast ( predicate : ( Char ) -> Boolean ) : Int

{ <EOL> for ( index in indices . reversed ( ) ) { <EOL> if ( predicate ( this [ index ] ) ) { <EOL> return index <EOL> } <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns index of the last character matching the given [predicate], or -1 if the char sequence does not contain such character.
 */


public fun CharSequence . last ( ) : Char

{ <EOL> if ( isEmpty ( ) ) <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> return this [ lastIndex ] <EOL> }

/**
 * Returns the last character.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 *
 * @sample samples.text.Strings.last
 */


public inline fun CharSequence . last ( predicate : ( Char ) -> Boolean ) : Char

{ <EOL> for ( index in this . indices . reversed ( ) ) { <EOL> val element = this [ index ] <EOL> if ( predicate ( element ) ) return element <EOL> } <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> }

/**
 * Returns the last character matching the given [predicate].
 *
 * @throws NoSuchElementException if no such character is found.
 *
 * @sample samples.text.Strings.last
 */


public fun CharSequence . lastOrNull ( ) : Char ?

{ <EOL> return if ( isEmpty ( ) ) null else this [ length - <NUM_LIT:1> ] <EOL> }

/**
 * Returns the last character, or `null` if the char sequence is empty.
 *
 * @sample samples.text.Strings.last
 */


public inline fun CharSequence . lastOrNull ( predicate : ( Char ) -> Boolean ) : Char ?

{ <EOL> for ( index in this . indices . reversed ( ) ) { <EOL> val element = this [ index ] <EOL> if ( predicate ( element ) ) return element <EOL> } <EOL> return null <EOL> }

/**
 * Returns the last character matching the given [predicate], or `null` if no such character was found.
 *
 * @sample samples.text.Strings.last
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . random ( ) : Char

{ <EOL> return random ( Random ) <EOL> }

/**
 * Returns a random character from this char sequence.
 *
 * @throws NoSuchElementException if this char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public fun CharSequence . random ( random : Random ) : Char

{ <EOL> if ( isEmpty ( ) ) <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> return get ( random . nextInt ( length ) ) <EOL> }

/**
 * Returns a random character from this char sequence using the specified source of randomness.
 *
 * @throws NoSuchElementException if this char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . randomOrNull ( ) : Char ?

{ <EOL> return randomOrNull ( Random ) <EOL> }

/**
 * Returns a random character from this char sequence, or `null` if this char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun CharSequence . randomOrNull ( random : Random ) : Char ?

{ <EOL> if ( isEmpty ( ) ) <EOL> return null <EOL> return get ( random . nextInt ( length ) ) <EOL> }

/**
 * Returns a random character from this char sequence using the specified source of randomness, or `null` if this char sequence is empty.
 */


public fun CharSequence . single ( ) : Char

{ <EOL> return when ( length ) { <EOL> <NUM_LIT:0> -> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> <NUM_LIT:1> -> this [ <NUM_LIT:0> ] <EOL> else -> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Returns the single character, or throws an exception if the char sequence is empty or has more than one character.
 */


public inline fun CharSequence . single ( predicate : ( Char ) -> Boolean ) : Char

{ <EOL> var single : Char ? = null <EOL> var found = false <EOL> for ( element in this ) { <EOL> if ( predicate ( element ) ) { <EOL> if ( found ) throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> single = element <EOL> found = true <EOL> } <EOL> } <EOL> if ( ! found ) throw NoSuchElementException ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return single as Char <EOL> }

/**
 * Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character.
 */


public fun CharSequence . singleOrNull ( ) : Char ?

{ <EOL> return if ( length == <NUM_LIT:1> ) this [ <NUM_LIT:0> ] else null <EOL> }

/**
 * Returns single character, or `null` if the char sequence is empty or has more than one character.
 */


public inline fun CharSequence . singleOrNull ( predicate : ( Char ) -> Boolean ) : Char ?

{ <EOL> var single : Char ? = null <EOL> var found = false <EOL> for ( element in this ) { <EOL> if ( predicate ( element ) ) { <EOL> if ( found ) return null <EOL> single = element <EOL> found = true <EOL> } <EOL> } <EOL> if ( ! found ) return null <EOL> return single <EOL> }

/**
 * Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found.
 */


public fun CharSequence . drop ( n : Int ) : CharSequence

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return subSequence ( n . coerceAtMost ( length ) , length ) <EOL> }

/**
 * Returns a subsequence of this char sequence with the first [n] characters removed.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.drop
 */


public fun String . drop ( n : Int ) : String

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return substring ( n . coerceAtMost ( length ) ) <EOL> }

/**
 * Returns a string with the first [n] characters removed.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.drop
 */


public fun CharSequence . dropLast ( n : Int ) : CharSequence

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return take ( ( length - n ) . coerceAtLeast ( <NUM_LIT:0> ) ) <EOL> }

/**
 * Returns a subsequence of this char sequence with the last [n] characters removed.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.drop
 */


public fun String . dropLast ( n : Int ) : String

/**
 * Returns a string with the last [n] characters removed.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.drop
 */


public inline fun CharSequence . dropLastWhile ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> for ( index in lastIndex downTo <NUM_LIT:0> ) <EOL> if ( ! predicate ( this [ index ] ) ) <EOL> return subSequence ( <NUM_LIT:0> , index + <NUM_LIT:1> ) <EOL> return "<STR_LIT>" <EOL> }

/**
 * Returns a subsequence of this char sequence containing all characters except last characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.drop
 */


public inline fun String . dropLastWhile ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> for ( index in lastIndex downTo <NUM_LIT:0> ) <EOL> if ( ! predicate ( this [ index ] ) ) <EOL> return substring ( <NUM_LIT:0> , index + <NUM_LIT:1> ) <EOL> return "<STR_LIT>" <EOL> }

/**
 * Returns a string containing all characters except last characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.drop
 */


public inline fun CharSequence . dropWhile ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> for ( index in this . indices ) <EOL> if ( ! predicate ( this [ index ] ) ) <EOL> return subSequence ( index , length ) <EOL> return "<STR_LIT>" <EOL> }

/**
 * Returns a subsequence of this char sequence containing all characters except first characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.drop
 */


public inline fun String . dropWhile ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> for ( index in this . indices ) <EOL> if ( ! predicate ( this [ index ] ) ) <EOL> return substring ( index ) <EOL> return "<STR_LIT>" <EOL> }

/**
 * Returns a string containing all characters except first characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.drop
 */


public inline fun CharSequence . filter ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> return filterTo ( StringBuilder ( ) , predicate ) <EOL> }

/**
 * Returns a char sequence containing only those characters from the original char sequence that match the given [predicate].
 *
 * @sample samples.text.Strings.filter
 */


public inline fun String . filter ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> return filterTo ( StringBuilder ( ) , predicate ) . toString ( ) <EOL> }

/**
 * Returns a string containing only those characters from the original string that match the given [predicate].
 *
 * @sample samples.text.Strings.filter
 */


public inline fun CharSequence . filterIndexed ( predicate : ( index : Int , Char ) -> Boolean ) : CharSequence

{ <EOL> return filterIndexedTo ( StringBuilder ( ) , predicate ) <EOL> }

/**
 * Returns a char sequence containing only those characters from the original char sequence that match the given [predicate].
 * @param [predicate] function that takes the index of a character and the character itself
 * and returns the result of predicate evaluation on the character.
 *
 * @sample samples.collections.Collections.Filtering.filterIndexed
 */


public inline fun String . filterIndexed ( predicate : ( index : Int , Char ) -> Boolean ) : String

{ <EOL> return filterIndexedTo ( StringBuilder ( ) , predicate ) . toString ( ) <EOL> }

/**
 * Returns a string containing only those characters from the original string that match the given [predicate].
 * @param [predicate] function that takes the index of a character and the character itself
 * and returns the result of predicate evaluation on the character.
 *
 * @sample samples.collections.Collections.Filtering.filterIndexed
 */


public inline fun < C : Appendable > CharSequence . filterIndexedTo ( destination : C , predicate : ( index : Int , Char ) -> Boolean ) : C

{ <EOL> forEachIndexed { index , element -> <EOL> if ( predicate ( index , element ) ) destination . append ( element ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends all characters matching the given [predicate] to the given [destination].
 * @param [predicate] function that takes the index of a character and the character itself
 * and returns the result of predicate evaluation on the character.
 *
 * @sample samples.collections.Collections.Filtering.filterIndexedTo
 */


public inline fun CharSequence . filterNot ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> return filterNotTo ( StringBuilder ( ) , predicate ) <EOL> }

/**
 * Returns a char sequence containing only those characters from the original char sequence that do not match the given [predicate].
 *
 * @sample samples.text.Strings.filterNot
 */


public inline fun String . filterNot ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> return filterNotTo ( StringBuilder ( ) , predicate ) . toString ( ) <EOL> }

/**
 * Returns a string containing only those characters from the original string that do not match the given [predicate].
 *
 * @sample samples.text.Strings.filterNot
 */


public inline fun < C : Appendable > CharSequence . filterNotTo ( destination : C , predicate : ( Char ) -> Boolean ) : C

{ <EOL> for ( element in this ) if ( ! predicate ( element ) ) destination . append ( element ) <EOL> return destination <EOL> }

/**
 * Appends all characters not matching the given [predicate] to the given [destination].
 *
 * @sample samples.collections.Collections.Filtering.filterTo
 */


public inline fun < C : Appendable > CharSequence . filterTo ( destination : C , predicate : ( Char ) -> Boolean ) : C

{ <EOL> for ( index in <NUM_LIT:0> until length ) { <EOL> val element = get ( index ) <EOL> if ( predicate ( element ) ) destination . append ( element ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends all characters matching the given [predicate] to the given [destination].
 *
 * @sample samples.collections.Collections.Filtering.filterTo
 */


public fun CharSequence . slice ( indices : IntRange ) : CharSequence

{ <EOL> if ( indices . isEmpty ( ) ) return "<STR_LIT>" <EOL> return subSequence ( indices ) <EOL> }

/**
 * Returns a char sequence containing characters of the original char sequence at the specified range of [indices].
 */


public fun String . slice ( indices : IntRange ) : String

{ <EOL> if ( indices . isEmpty ( ) ) return "<STR_LIT>" <EOL> return substring ( indices ) <EOL> }

/**
 * Returns a string containing characters of the original string at the specified range of [indices].
 */


public fun CharSequence . slice ( indices : Iterable < Int > ) : CharSequence

{ <EOL> val size = indices . collectionSizeOrDefault ( <NUM_LIT:10> ) <EOL> if ( size == <NUM_LIT:0> ) return "<STR_LIT>" <EOL> val result = StringBuilder ( size ) <EOL> for ( i in indices ) { <EOL> result . append ( get ( i ) ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a char sequence containing characters of the original char sequence at specified [indices].
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun String . slice ( indices : Iterable < Int > ) : String

{ <EOL> return ( this as CharSequence ) . slice ( indices ) . toString ( ) <EOL> }

/**
 * Returns a string containing characters of the original string at specified [indices].
 */


public fun CharSequence . take ( n : Int ) : CharSequence

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return subSequence ( <NUM_LIT:0> , n . coerceAtMost ( length ) ) <EOL> }

/**
 * Returns a subsequence of this char sequence containing the first [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.take
 */


public fun String . take ( n : Int ) : String

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return substring ( <NUM_LIT:0> , n . coerceAtMost ( length ) ) <EOL> }

/**
 * Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.take
 */


public fun CharSequence . takeLast ( n : Int ) : CharSequence

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> val length = length <EOL> return subSequence ( length - n . coerceAtMost ( length ) , length ) <EOL> }

/**
 * Returns a subsequence of this char sequence containing the last [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.take
 */


public fun String . takeLast ( n : Int ) : String

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> val length = length <EOL> return substring ( length - n . coerceAtMost ( length ) ) <EOL> }

/**
 * Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.text.Strings.take
 */


public inline fun CharSequence . takeLastWhile ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> for ( index in lastIndex downTo <NUM_LIT:0> ) { <EOL> if ( ! predicate ( this [ index ] ) ) { <EOL> return subSequence ( index + <NUM_LIT:1> , length ) <EOL> } <EOL> } <EOL> return subSequence ( <NUM_LIT:0> , length ) <EOL> }

/**
 * Returns a subsequence of this char sequence containing last characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.take
 */


public inline fun String . takeLastWhile ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> for ( index in lastIndex downTo <NUM_LIT:0> ) { <EOL> if ( ! predicate ( this [ index ] ) ) { <EOL> return substring ( index + <NUM_LIT:1> ) <EOL> } <EOL> } <EOL> return this <EOL> }

/**
 * Returns a string containing last characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.take
 */


public inline fun CharSequence . takeWhile ( predicate : ( Char ) -> Boolean ) : CharSequence

{ <EOL> for ( index in <NUM_LIT:0> until length ) <EOL> if ( ! predicate ( get ( index ) ) ) { <EOL> return subSequence ( <NUM_LIT:0> , index ) <EOL> } <EOL> return subSequence ( <NUM_LIT:0> , length ) <EOL> }

/**
 * Returns a subsequence of this char sequence containing the first characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.take
 */


public inline fun String . takeWhile ( predicate : ( Char ) -> Boolean ) : String

{ <EOL> for ( index in <NUM_LIT:0> until length ) <EOL> if ( ! predicate ( get ( index ) ) ) { <EOL> return substring ( <NUM_LIT:0> , index ) <EOL> } <EOL> return this <EOL> }

/**
 * Returns a string containing the first characters that satisfy the given [predicate].
 *
 * @sample samples.text.Strings.take
 */


public fun CharSequence . reversed ( ) : CharSequence

{ <EOL> return StringBuilder ( this ) . reverse ( ) <EOL> }

/**
 * Returns a char sequence with characters in reversed order.
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun String . reversed ( ) : String

{ <EOL> return ( this as CharSequence ) . reversed ( ) . toString ( ) <EOL> }

/**
 * Returns a string with characters in reversed order.
 */


public inline fun < K , V > CharSequence . associate ( transform : ( Char ) -> Pair < K , V > ) : Map < K , V >

{ <EOL> val capacity = mapCapacity ( length ) . coerceAtLeast ( <NUM_LIT:16> ) <EOL> return associateTo ( LinkedHashMap < K , V > ( capacity ) , transform ) <EOL> }

/**
 * Returns a [Map] containing key-value pairs provided by [transform] function
 * applied to characters of the given char sequence.
 *
 * If any of two pairs would have the same key the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original char sequence.
 *
 * @sample samples.text.Strings.associate
 */


public inline fun < K > CharSequence . associateBy ( keySelector : ( Char ) -> K ) : Map < K , Char >

{ <EOL> val capacity = mapCapacity ( length ) . coerceAtLeast ( <NUM_LIT:16> ) <EOL> return associateByTo ( LinkedHashMap < K , Char > ( capacity ) , keySelector ) <EOL> }

/**
 * Returns a [Map] containing the characters from the given char sequence indexed by the key
 * returned from [keySelector] function applied to each character.
 *
 * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original char sequence.
 *
 * @sample samples.text.Strings.associateBy
 */


public inline fun < K , V > CharSequence . associateBy ( keySelector : ( Char ) -> K , valueTransform : ( Char ) -> V ) : Map < K , V >

{ <EOL> val capacity = mapCapacity ( length ) . coerceAtLeast ( <NUM_LIT:16> ) <EOL> return associateByTo ( LinkedHashMap < K , V > ( capacity ) , keySelector , valueTransform ) <EOL> }

/**
 * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to characters of the given char sequence.
 *
 * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original char sequence.
 *
 * @sample samples.text.Strings.associateByWithValueTransform
 */


public inline fun < K , M : MutableMap < in K , in Char > > CharSequence . associateByTo ( destination : M , keySelector : ( Char ) -> K ) : M

{ <EOL> for ( element in this ) { <EOL> destination . put ( keySelector ( element ) , element ) <EOL> } <EOL> return destination <EOL> }

/**
 * Populates and returns the [destination] mutable map with key-value pairs,
 * where key is provided by the [keySelector] function applied to each character of the given char sequence
 * and value is the character itself.
 *
 * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
 *
 * @sample samples.text.Strings.associateByTo
 */


public inline fun < K , V , M : MutableMap < in K , in V > > CharSequence . associateByTo ( destination : M , keySelector : ( Char ) -> K , valueTransform : ( Char ) -> V ) : M

{ <EOL> for ( element in this ) { <EOL> destination . put ( keySelector ( element ) , valueTransform ( element ) ) <EOL> } <EOL> return destination <EOL> }

/**
 * Populates and returns the [destination] mutable map with key-value pairs,
 * where key is provided by the [keySelector] function and
 * and value is provided by the [valueTransform] function applied to characters of the given char sequence.
 *
 * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
 *
 * @sample samples.text.Strings.associateByToWithValueTransform
 */


public inline fun < K , V , M : MutableMap < in K , in V > > CharSequence . associateTo ( destination : M , transform : ( Char ) -> Pair < K , V > ) : M

{ <EOL> for ( element in this ) { <EOL> destination += transform ( element ) <EOL> } <EOL> return destination <EOL> }

/**
 * Populates and returns the [destination] mutable map with key-value pairs
 * provided by [transform] function applied to each character of the given char sequence.
 *
 * If any of two pairs would have the same key the last one gets added to the map.
 *
 * @sample samples.text.Strings.associateTo
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public inline fun < V > CharSequence . associateWith ( valueSelector : ( Char ) -> V ) : Map < Char , V >

{ <EOL> val result = LinkedHashMap < Char , V > ( mapCapacity ( length . coerceAtMost ( <NUM_LIT> ) ) . coerceAtLeast ( <NUM_LIT:16> ) ) <EOL> return associateWithTo ( result , valueSelector ) <EOL> }

/**
 * Returns a [Map] where keys are characters from the given char sequence and values are
 * produced by the [valueSelector] function applied to each character.
 *
 * If any two characters are equal, the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original char sequence.
 *
 * @sample samples.text.Strings.associateWith
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public inline fun < V , M : MutableMap < in Char , in V > > CharSequence . associateWithTo ( destination : M , valueSelector : ( Char ) -> V ) : M

{ <EOL> for ( element in this ) { <EOL> destination . put ( element , valueSelector ( element ) ) <EOL> } <EOL> return destination <EOL> }

/**
 * Populates and returns the [destination] mutable map with key-value pairs for each character of the given char sequence,
 * where key is the character itself and value is provided by the [valueSelector] function applied to that key.
 *
 * If any two characters are equal, the last one overwrites the former value in the map.
 *
 * @sample samples.text.Strings.associateWithTo
 */


public fun < C : MutableCollection < in Char > > CharSequence . toCollection ( destination : C ) : C

{ <EOL> for ( item in this ) { <EOL> destination . add ( item ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends all characters to the given [destination] collection.
 */


public fun CharSequence . toHashSet ( ) : HashSet < Char >

{ <EOL> return toCollection ( HashSet < Char > ( mapCapacity ( length . coerceAtMost ( <NUM_LIT> ) ) ) ) <EOL> }

/**
 * Returns a new [HashSet] of all characters.
 */


public fun CharSequence . toList ( ) : List < Char >

{ <EOL> return when ( length ) { <EOL> <NUM_LIT:0> -> emptyList ( ) <EOL> <NUM_LIT:1> -> listOf ( this [ <NUM_LIT:0> ] ) <EOL> else -> this . toMutableList ( ) <EOL> } <EOL> }

/**
 * Returns a [List] containing all characters.
 */


public fun CharSequence . toMutableList ( ) : MutableList < Char >

{ <EOL> return toCollection ( ArrayList < Char > ( length ) ) <EOL> }

/**
 * Returns a new [MutableList] filled with all characters of this char sequence.
 */


public fun CharSequence . toSet ( ) : Set < Char >

{ <EOL> return when ( length ) { <EOL> <NUM_LIT:0> -> emptySet ( ) <EOL> <NUM_LIT:1> -> setOf ( this [ <NUM_LIT:0> ] ) <EOL> else -> toCollection ( LinkedHashSet < Char > ( mapCapacity ( length . coerceAtMost ( <NUM_LIT> ) ) ) ) <EOL> } <EOL> }

/**
 * Returns a [Set] of all characters.
 *
 * The returned set preserves the element iteration order of the original char sequence.
 */


public inline fun < R > CharSequence . flatMap ( transform : ( Char ) -> Iterable < R > ) : List < R >

{ <EOL> return flatMapTo ( ArrayList < R > ( ) , transform ) <EOL> }

/**
 * Returns a single list of all elements yielded from results of [transform] function being invoked on each character of original char sequence.
 *
 * @sample samples.collections.Collections.Transformations.flatMap
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R > CharSequence . flatMapIndexed ( transform : ( index : Int , Char ) -> Iterable < R > ) : List < R >

{ <EOL> return flatMapIndexedTo ( ArrayList < R > ( ) , transform ) <EOL> }

/**
 * Returns a single list of all elements yielded from results of [transform] function being invoked on each character
 * and its index in the original char sequence.
 *
 * @sample samples.collections.Collections.Transformations.flatMapIndexed
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R , C : MutableCollection < in R > > CharSequence . flatMapIndexedTo ( destination : C , transform : ( index : Int , Char ) -> Iterable < R > ) : C

{ <EOL> var index = <NUM_LIT:0> <EOL> for ( element in this ) { <EOL> val list = transform ( index ++ , element ) <EOL> destination . addAll ( list ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends all elements yielded from results of [transform] function being invoked on each character
 * and its index in the original char sequence, to the given [destination].
 */


public inline fun < R , C : MutableCollection < in R > > CharSequence . flatMapTo ( destination : C , transform : ( Char ) -> Iterable < R > ) : C

{ <EOL> for ( element in this ) { <EOL> val list = transform ( element ) <EOL> destination . addAll ( list ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends all elements yielded from results of [transform] function being invoked on each character of original char sequence, to the given [destination].
 */


public inline fun < K > CharSequence . groupBy ( keySelector : ( Char ) -> K ) : Map < K , List < Char > >

{ <EOL> return groupByTo ( LinkedHashMap < K , MutableList < Char > > ( ) , keySelector ) <EOL> }

/**
 * Groups characters of the original char sequence by the key returned by the given [keySelector] function
 * applied to each character and returns a map where each group key is associated with a list of corresponding characters.
 *
 * The returned map preserves the entry iteration order of the keys produced from the original char sequence.
 *
 * @sample samples.collections.Collections.Transformations.groupBy
 */


public inline fun < K , V > CharSequence . groupBy ( keySelector : ( Char ) -> K , valueTransform : ( Char ) -> V ) : Map < K , List < V > >

{ <EOL> return groupByTo ( LinkedHashMap < K , MutableList < V > > ( ) , keySelector , valueTransform ) <EOL> }

/**
 * Groups values returned by the [valueTransform] function applied to each character of the original char sequence
 * by the key returned by the given [keySelector] function applied to the character
 * and returns a map where each group key is associated with a list of corresponding values.
 *
 * The returned map preserves the entry iteration order of the keys produced from the original char sequence.
 *
 * @sample samples.collections.Collections.Transformations.groupByKeysAndValues
 */


public inline fun < K , M : MutableMap < in K , MutableList < Char > > > CharSequence . groupByTo ( destination : M , keySelector : ( Char ) -> K ) : M

{ <EOL> for ( element in this ) { <EOL> val key = keySelector ( element ) <EOL> val list = destination . getOrPut ( key ) { ArrayList < Char > ( ) } <EOL> list . add ( element ) <EOL> } <EOL> return destination <EOL> }

/**
 * Groups characters of the original char sequence by the key returned by the given [keySelector] function
 * applied to each character and puts to the [destination] map each group key associated with a list of corresponding characters.
 *
 * @return The [destination] map.
 *
 * @sample samples.collections.Collections.Transformations.groupBy
 */


public inline fun < K , V , M : MutableMap < in K , MutableList < V > > > CharSequence . groupByTo ( destination : M , keySelector : ( Char ) -> K , valueTransform : ( Char ) -> V ) : M

{ <EOL> for ( element in this ) { <EOL> val key = keySelector ( element ) <EOL> val list = destination . getOrPut ( key ) { ArrayList < V > ( ) } <EOL> list . add ( valueTransform ( element ) ) <EOL> } <EOL> return destination <EOL> }

/**
 * Groups values returned by the [valueTransform] function applied to each character of the original char sequence
 * by the key returned by the given [keySelector] function applied to the character
 * and puts to the [destination] map each group key associated with a list of corresponding values.
 *
 * @return The [destination] map.
 *
 * @sample samples.collections.Collections.Transformations.groupByKeysAndValues
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public inline fun < K > CharSequence . groupingBy ( crossinline keySelector : ( Char ) -> K ) : Grouping < Char , K >

{ <EOL> return object : Grouping < Char , K > { <EOL> override fun sourceIterator ( ) : Iterator < Char > = this@groupingBy . iterator ( ) <EOL> override fun keyOf ( element : Char ) : K = keySelector ( element ) <EOL> } <EOL> }

/**
 * Creates a [Grouping] source from a char sequence to be used later with one of group-and-fold operations
 * using the specified [keySelector] function to extract a key from each character.
 *
 * @sample samples.collections.Grouping.groupingByEachCount
 */


public inline fun < R > CharSequence . map ( transform : ( Char ) -> R ) : List < R >

{ <EOL> return mapTo ( ArrayList < R > ( length ) , transform ) <EOL> }

/**
 * Returns a list containing the results of applying the given [transform] function
 * to each character in the original char sequence.
 *
 * @sample samples.text.Strings.map
 */


public inline fun < R > CharSequence . mapIndexed ( transform : ( index : Int , Char ) -> R ) : List < R >

{ <EOL> return mapIndexedTo ( ArrayList < R > ( length ) , transform ) <EOL> }

/**
 * Returns a list containing the results of applying the given [transform] function
 * to each character and its index in the original char sequence.
 * @param [transform] function that takes the index of a character and the character itself
 * and returns the result of the transform applied to the character.
 */


public inline fun < R : Any > CharSequence . mapIndexedNotNull ( transform : ( index : Int , Char ) -> R ? ) : List < R >

{ <EOL> return mapIndexedNotNullTo ( ArrayList < R > ( ) , transform ) <EOL> }

/**
 * Returns a list containing only the non-null results of applying the given [transform] function
 * to each character and its index in the original char sequence.
 * @param [transform] function that takes the index of a character and the character itself
 * and returns the result of the transform applied to the character.
 */


public inline fun < R : Any , C : MutableCollection < in R > > CharSequence . mapIndexedNotNullTo ( destination : C , transform : ( index : Int , Char ) -> R ? ) : C

{ <EOL> forEachIndexed { index , element -> transform ( index , element ) ? . let { destination . add ( it ) } } <EOL> return destination <EOL> }

/**
 * Applies the given [transform] function to each character and its index in the original char sequence
 * and appends only the non-null results to the given [destination].
 * @param [transform] function that takes the index of a character and the character itself
 * and returns the result of the transform applied to the character.
 */


public inline fun < R , C : MutableCollection < in R > > CharSequence . mapIndexedTo ( destination : C , transform : ( index : Int , Char ) -> R ) : C

{ <EOL> var index = <NUM_LIT:0> <EOL> for ( item in this ) <EOL> destination . add ( transform ( index ++ , item ) ) <EOL> return destination <EOL> }

/**
 * Applies the given [transform] function to each character and its index in the original char sequence
 * and appends the results to the given [destination].
 * @param [transform] function that takes the index of a character and the character itself
 * and returns the result of the transform applied to the character.
 */


public inline fun < R : Any > CharSequence . mapNotNull ( transform : ( Char ) -> R ? ) : List < R >

{ <EOL> return mapNotNullTo ( ArrayList < R > ( ) , transform ) <EOL> }

/**
 * Returns a list containing only the non-null results of applying the given [transform] function
 * to each character in the original char sequence.
 *
 * @sample samples.collections.Collections.Transformations.mapNotNull
 */


public inline fun < R : Any , C : MutableCollection < in R > > CharSequence . mapNotNullTo ( destination : C , transform : ( Char ) -> R ? ) : C

{ <EOL> forEach { element -> transform ( element ) ? . let { destination . add ( it ) } } <EOL> return destination <EOL> }

/**
 * Applies the given [transform] function to each character in the original char sequence
 * and appends only the non-null results to the given [destination].
 */


public inline fun < R , C : MutableCollection < in R > > CharSequence . mapTo ( destination : C , transform : ( Char ) -> R ) : C

{ <EOL> for ( item in this ) <EOL> destination . add ( transform ( item ) ) <EOL> return destination <EOL> }

/**
 * Applies the given [transform] function to each character of the original char sequence
 * and appends the results to the given [destination].
 */


public fun CharSequence . withIndex ( ) : Iterable < IndexedValue < Char > >

{ <EOL> return IndexingIterable { iterator ( ) } <EOL> }

/**
 * Returns a lazy [Iterable] that wraps each character of the original char sequence
 * into an [IndexedValue] containing the index of that character and the character itself.
 */


public inline fun CharSequence . all ( predicate : ( Char ) -> Boolean ) : Boolean

{ <EOL> for ( element in this ) if ( ! predicate ( element ) ) return false <EOL> return true <EOL> }

/**
 * Returns `true` if all characters match the given [predicate].
 *
 * Note that if the char sequence contains no characters, the function returns `true`
 * because there are no characters in it that _do not_ match the predicate.
 * See a more detailed explanation of this logic concept in ["Vacuous truth"](https://en.wikipedia.org/wiki/Vacuous_truth) article.
 *
 * @sample samples.collections.Collections.Aggregates.all
 */


public fun CharSequence . any ( ) : Boolean

{ <EOL> return ! isEmpty ( ) <EOL> }

/**
 * Returns `true` if char sequence has at least one character.
 *
 * @sample samples.collections.Collections.Aggregates.any
 */


public inline fun CharSequence . any ( predicate : ( Char ) -> Boolean ) : Boolean

{ <EOL> for ( element in this ) if ( predicate ( element ) ) return true <EOL> return false <EOL> }

/**
 * Returns `true` if at least one character matches the given [predicate].
 *
 * @sample samples.collections.Collections.Aggregates.anyWithPredicate
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . count ( ) : Int

{ <EOL> return length <EOL> }

/**
 * Returns the length of this char sequence.
 */


public inline fun CharSequence . count ( predicate : ( Char ) -> Boolean ) : Int

{ <EOL> var count = <NUM_LIT:0> <EOL> for ( element in this ) if ( predicate ( element ) ) ++ count <EOL> return count <EOL> }

/**
 * Returns the number of characters matching the given [predicate].
 */


public inline fun < R > CharSequence . fold ( initial : R , operation : ( acc : R , Char ) -> R ) : R

{ <EOL> var accumulator = initial <EOL> for ( element in this ) accumulator = operation ( accumulator , element ) <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with [initial] value and applying [operation] from left to right
 * to current accumulator value and each character.
 *
 * Returns the specified [initial] value if the char sequence is empty.
 *
 * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.
 */


public inline fun < R > CharSequence . foldIndexed ( initial : R , operation : ( index : Int , acc : R , Char ) -> R ) : R

{ <EOL> var index = <NUM_LIT:0> <EOL> var accumulator = initial <EOL> for ( element in this ) accumulator = operation ( index ++ , accumulator , element ) <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with [initial] value and applying [operation] from left to right
 * to current accumulator value and each character with its index in the original char sequence.
 *
 * Returns the specified [initial] value if the char sequence is empty.
 *
 * @param [operation] function that takes the index of a character, current accumulator value
 * and the character itself, and calculates the next accumulator value.
 */


public inline fun < R > CharSequence . foldRight ( initial : R , operation : ( Char , acc : R ) -> R ) : R

{ <EOL> var index = lastIndex <EOL> var accumulator = initial <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( get ( index -- ) , accumulator ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with [initial] value and applying [operation] from right to left
 * to each character and current accumulator value.
 *
 * Returns the specified [initial] value if the char sequence is empty.
 *
 * @param [operation] function that takes a character and current accumulator value, and calculates the next accumulator value.
 */


public inline fun < R > CharSequence . foldRightIndexed ( initial : R , operation : ( index : Int , Char , acc : R ) -> R ) : R

{ <EOL> var index = lastIndex <EOL> var accumulator = initial <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( index , get ( index ) , accumulator ) <EOL> -- index <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with [initial] value and applying [operation] from right to left
 * to each character with its index in the original char sequence and current accumulator value.
 *
 * Returns the specified [initial] value if the char sequence is empty.
 *
 * @param [operation] function that takes the index of a character, the character itself
 * and current accumulator value, and calculates the next accumulator value.
 */


public inline fun CharSequence . forEach ( action : ( Char ) -> Unit ) : Unit

{ <EOL> for ( element in this ) action ( element ) <EOL> }

/**
 * Performs the given [action] on each character.
 */


public inline fun CharSequence . forEachIndexed ( action : ( index : Int , Char ) -> Unit ) : Unit

{ <EOL> var index = <NUM_LIT:0> <EOL> for ( item in this ) action ( index ++ , item ) <EOL> }

/**
 * Performs the given [action] on each character, providing sequential index with the character.
 * @param [action] function that takes the index of a character and the character itself
 * and performs the action on the character.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public fun CharSequence . max ( ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var max = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( max < e ) max = e <EOL> } <EOL> return max <EOL> }

/**
 * Returns the largest character.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public inline fun < R : Comparable < R > > CharSequence . maxBy ( selector : ( Char ) -> R ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var maxElem = this [ <NUM_LIT:0> ] <EOL> val lastIndex = this . lastIndex <EOL> if ( lastIndex == <NUM_LIT:0> ) return maxElem <EOL> var maxValue = selector ( maxElem ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> val v = selector ( e ) <EOL> if ( maxValue < v ) { <EOL> maxElem = e <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxElem <EOL> }

/**
 * Returns the first character yielding the largest value of the given function.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 *
 * @sample samples.collections.Collections.Aggregates.maxBy
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R : Comparable < R > > CharSequence . maxByOrNull ( selector : ( Char ) -> R ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var maxElem = this [ <NUM_LIT:0> ] <EOL> val lastIndex = this . lastIndex <EOL> if ( lastIndex == <NUM_LIT:0> ) return maxElem <EOL> var maxValue = selector ( maxElem ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> val v = selector ( e ) <EOL> if ( maxValue < v ) { <EOL> maxElem = e <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxElem <EOL> }

/**
 * Returns the first character yielding the largest value of the given function or `null` if there are no characters.
 *
 * @sample samples.collections.Collections.Aggregates.maxByOrNull
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . maxOf ( selector : ( Char ) -> Double ) : Double

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> maxValue = maxOf ( maxValue , v ) <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each character in the char sequence.
 *
 * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . maxOf ( selector : ( Char ) -> Float ) : Float


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Comparable < R > > CharSequence . maxOf ( selector : ( Char ) -> R ) : R

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( maxValue < v ) { <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each character in the char sequence.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . maxOfOrNull ( selector : ( Char ) -> Double ) : Double ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> maxValue = maxOf ( maxValue , v ) <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each character in the char sequence or `null` if there are no characters.
 *
 * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . maxOfOrNull ( selector : ( Char ) -> Float ) : Float ?


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Comparable < R > > CharSequence . maxOfOrNull ( selector : ( Char ) -> R ) : R ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( maxValue < v ) { <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each character in the char sequence or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R > CharSequence . maxOfWith ( comparator : Comparator < in R > , selector : ( Char ) -> R ) : R

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( comparator . compare ( maxValue , v ) < <NUM_LIT:0> ) { <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value according to the provided [comparator]
 * among all values produced by [selector] function applied to each character in the char sequence.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R > CharSequence . maxOfWithOrNull ( comparator : Comparator < in R > , selector : ( Char ) -> R ) : R ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var maxValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( comparator . compare ( maxValue , v ) < <NUM_LIT:0> ) { <EOL> maxValue = v <EOL> } <EOL> } <EOL> return maxValue <EOL> }

/**
 * Returns the largest value according to the provided [comparator]
 * among all values produced by [selector] function applied to each character in the char sequence or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun CharSequence . maxOrNull ( ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var max = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( max < e ) max = e <EOL> } <EOL> return max <EOL> }

/**
 * Returns the largest character or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public fun CharSequence . maxWith ( comparator : Comparator < in Char > ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var max = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( comparator . compare ( max , e ) < <NUM_LIT:0> ) max = e <EOL> } <EOL> return max <EOL> }

/**
 * Returns the first character having the largest value according to the provided [comparator].
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun CharSequence . maxWithOrNull ( comparator : Comparator < in Char > ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var max = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( comparator . compare ( max , e ) < <NUM_LIT:0> ) max = e <EOL> } <EOL> return max <EOL> }

/**
 * Returns the first character having the largest value according to the provided [comparator] or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public fun CharSequence . min ( ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var min = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( min > e ) min = e <EOL> } <EOL> return min <EOL> }

/**
 * Returns the smallest character.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public inline fun < R : Comparable < R > > CharSequence . minBy ( selector : ( Char ) -> R ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var minElem = this [ <NUM_LIT:0> ] <EOL> val lastIndex = this . lastIndex <EOL> if ( lastIndex == <NUM_LIT:0> ) return minElem <EOL> var minValue = selector ( minElem ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> val v = selector ( e ) <EOL> if ( minValue > v ) { <EOL> minElem = e <EOL> minValue = v <EOL> } <EOL> } <EOL> return minElem <EOL> }

/**
 * Returns the first character yielding the smallest value of the given function.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 *
 * @sample samples.collections.Collections.Aggregates.minBy
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R : Comparable < R > > CharSequence . minByOrNull ( selector : ( Char ) -> R ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var minElem = this [ <NUM_LIT:0> ] <EOL> val lastIndex = this . lastIndex <EOL> if ( lastIndex == <NUM_LIT:0> ) return minElem <EOL> var minValue = selector ( minElem ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> val v = selector ( e ) <EOL> if ( minValue > v ) { <EOL> minElem = e <EOL> minValue = v <EOL> } <EOL> } <EOL> return minElem <EOL> }

/**
 * Returns the first character yielding the smallest value of the given function or `null` if there are no characters.
 *
 * @sample samples.collections.Collections.Aggregates.minByOrNull
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . minOf ( selector : ( Char ) -> Double ) : Double

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> minValue = minOf ( minValue , v ) <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value among all values produced by [selector] function
 * applied to each character in the char sequence.
 *
 * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . minOf ( selector : ( Char ) -> Float ) : Float


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Comparable < R > > CharSequence . minOf ( selector : ( Char ) -> R ) : R

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( minValue > v ) { <EOL> minValue = v <EOL> } <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value among all values produced by [selector] function
 * applied to each character in the char sequence.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . minOfOrNull ( selector : ( Char ) -> Double ) : Double ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> minValue = minOf ( minValue , v ) <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value among all values produced by [selector] function
 * applied to each character in the char sequence or `null` if there are no characters.
 *
 * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . minOfOrNull ( selector : ( Char ) -> Float ) : Float ?


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R : Comparable < R > > CharSequence . minOfOrNull ( selector : ( Char ) -> R ) : R ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( minValue > v ) { <EOL> minValue = v <EOL> } <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value among all values produced by [selector] function
 * applied to each character in the char sequence or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R > CharSequence . minOfWith ( comparator : Comparator < in R > , selector : ( Char ) -> R ) : R

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( comparator . compare ( minValue , v ) > <NUM_LIT:0> ) { <EOL> minValue = v <EOL> } <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value according to the provided [comparator]
 * among all values produced by [selector] function applied to each character in the char sequence.
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < R > CharSequence . minOfWithOrNull ( comparator : Comparator < in R > , selector : ( Char ) -> R ) : R ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var minValue = selector ( this [ <NUM_LIT:0> ] ) <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val v = selector ( this [ i ] ) <EOL> if ( comparator . compare ( minValue , v ) > <NUM_LIT:0> ) { <EOL> minValue = v <EOL> } <EOL> } <EOL> return minValue <EOL> }

/**
 * Returns the smallest value according to the provided [comparator]
 * among all values produced by [selector] function applied to each character in the char sequence or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun CharSequence . minOrNull ( ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var min = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( min > e ) min = e <EOL> } <EOL> return min <EOL> }

/**
 * Returns the smallest character or `null` if there are no characters.
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:CONFLICTING_OVERLOADS>" ) <EOL> public fun CharSequence . minWith ( comparator : Comparator < in Char > ) : Char

{ <EOL> if ( isEmpty ( ) ) throw NoSuchElementException ( ) <EOL> var min = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( comparator . compare ( min , e ) > <NUM_LIT:0> ) min = e <EOL> } <EOL> return min <EOL> }

/**
 * Returns the first character having the smallest value according to the provided [comparator].
 *
 * @throws NoSuchElementException if the char sequence is empty.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun CharSequence . minWithOrNull ( comparator : Comparator < in Char > ) : Char ?

{ <EOL> if ( isEmpty ( ) ) return null <EOL> var min = this [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:1> .. lastIndex ) { <EOL> val e = this [ i ] <EOL> if ( comparator . compare ( min , e ) > <NUM_LIT:0> ) min = e <EOL> } <EOL> return min <EOL> }

/**
 * Returns the first character having the smallest value according to the provided [comparator] or `null` if there are no characters.
 */


public fun CharSequence . none ( ) : Boolean

{ <EOL> return isEmpty ( ) <EOL> }

/**
 * Returns `true` if the char sequence has no characters.
 *
 * @sample samples.collections.Collections.Aggregates.none
 */


public inline fun CharSequence . none ( predicate : ( Char ) -> Boolean ) : Boolean

{ <EOL> for ( element in this ) if ( predicate ( element ) ) return false <EOL> return true <EOL> }

/**
 * Returns `true` if no characters match the given [predicate].
 *
 * @sample samples.collections.Collections.Aggregates.noneWithPredicate
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public inline fun < S : CharSequence > S . onEach ( action : ( Char ) -> Unit ) : S

{ <EOL> return apply { for ( element in this ) action ( element ) } <EOL> }

/**
 * Performs the given [action] on each character and returns the char sequence itself afterwards.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < S : CharSequence > S . onEachIndexed ( action : ( index : Int , Char ) -> Unit ) : S

{ <EOL> return apply { forEachIndexed ( action ) } <EOL> }

/**
 * Performs the given [action] on each character, providing sequential index with the character,
 * and returns the char sequence itself afterwards.
 * @param [action] function that takes the index of a character and the character itself
 * and performs the action on the character.
 */


public inline fun CharSequence . reduce ( operation : ( acc : Char , Char ) -> Char ) : Char

{ <EOL> if ( isEmpty ( ) ) <EOL> throw UnsupportedOperationException ( "<STR_LIT>" ) <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> for ( index in <NUM_LIT:1> .. lastIndex ) { <EOL> accumulator = operation ( accumulator , this [ index ] ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the first character and applying [operation] from left to right
 * to current accumulator value and each character.
 *
 * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,
 * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.
 *
 * @param [operation] function that takes current accumulator value and a character,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduce
 */


public inline fun CharSequence . reduceIndexed ( operation : ( index : Int , acc : Char , Char ) -> Char ) : Char

{ <EOL> if ( isEmpty ( ) ) <EOL> throw UnsupportedOperationException ( "<STR_LIT>" ) <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> for ( index in <NUM_LIT:1> .. lastIndex ) { <EOL> accumulator = operation ( index , accumulator , this [ index ] ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the first character and applying [operation] from left to right
 * to current accumulator value and each character with its index in the original char sequence.
 *
 * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,
 * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.
 *
 * @param [operation] function that takes the index of a character, current accumulator value and the character itself,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduce
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . reduceIndexedOrNull ( operation : ( index : Int , acc : Char , Char ) -> Char ) : Char ?

{ <EOL> if ( isEmpty ( ) ) <EOL> return null <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> for ( index in <NUM_LIT:1> .. lastIndex ) { <EOL> accumulator = operation ( index , accumulator , this [ index ] ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the first character and applying [operation] from left to right
 * to current accumulator value and each character with its index in the original char sequence.
 *
 * Returns `null` if the char sequence is empty.
 *
 * @param [operation] function that takes the index of a character, current accumulator value and the character itself,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceOrNull
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . reduceOrNull ( operation : ( acc : Char , Char ) -> Char ) : Char ?

{ <EOL> if ( isEmpty ( ) ) <EOL> return null <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> for ( index in <NUM_LIT:1> .. lastIndex ) { <EOL> accumulator = operation ( accumulator , this [ index ] ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the first character and applying [operation] from left to right
 * to current accumulator value and each character.
 *
 * Returns `null` if the char sequence is empty.
 *
 * @param [operation] function that takes current accumulator value and a character,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceOrNull
 */


public inline fun CharSequence . reduceRight ( operation : ( Char , acc : Char ) -> Char ) : Char

{ <EOL> var index = lastIndex <EOL> if ( index < <NUM_LIT:0> ) throw UnsupportedOperationException ( "<STR_LIT>" ) <EOL> var accumulator = get ( index -- ) <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( get ( index -- ) , accumulator ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the last character and applying [operation] from right to left
 * to each character and current accumulator value.
 *
 * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,
 * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.
 *
 * @param [operation] function that takes a character and current accumulator value,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceRight
 */


public inline fun CharSequence . reduceRightIndexed ( operation : ( index : Int , Char , acc : Char ) -> Char ) : Char

{ <EOL> var index = lastIndex <EOL> if ( index < <NUM_LIT:0> ) throw UnsupportedOperationException ( "<STR_LIT>" ) <EOL> var accumulator = get ( index -- ) <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( index , get ( index ) , accumulator ) <EOL> -- index <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the last character and applying [operation] from right to left
 * to each character with its index in the original char sequence and current accumulator value.
 *
 * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,
 * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.
 *
 * @param [operation] function that takes the index of a character, the character itself and current accumulator value,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceRight
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . reduceRightIndexedOrNull ( operation : ( index : Int , Char , acc : Char ) -> Char ) : Char ?

{ <EOL> var index = lastIndex <EOL> if ( index < <NUM_LIT:0> ) return null <EOL> var accumulator = get ( index -- ) <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( index , get ( index ) , accumulator ) <EOL> -- index <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the last character and applying [operation] from right to left
 * to each character with its index in the original char sequence and current accumulator value.
 *
 * Returns `null` if the char sequence is empty.
 *
 * @param [operation] function that takes the index of a character, the character itself and current accumulator value,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceRightOrNull
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . reduceRightOrNull ( operation : ( Char , acc : Char ) -> Char ) : Char ?

{ <EOL> var index = lastIndex <EOL> if ( index < <NUM_LIT:0> ) return null <EOL> var accumulator = get ( index -- ) <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> accumulator = operation ( get ( index -- ) , accumulator ) <EOL> } <EOL> return accumulator <EOL> }

/**
 * Accumulates value starting with the last character and applying [operation] from right to left
 * to each character and current accumulator value.
 *
 * Returns `null` if the char sequence is empty.
 *
 * @param [operation] function that takes a character and current accumulator value,
 * and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.reduceRightOrNull
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R > CharSequence . runningFold ( initial : R , operation : ( acc : R , Char ) -> R ) : List < R >

{ <EOL> if ( isEmpty ( ) ) return listOf ( initial ) <EOL> val result = ArrayList < R > ( length + <NUM_LIT:1> ) . apply { add ( initial ) } <EOL> var accumulator = initial <EOL> for ( element in this ) { <EOL> accumulator = operation ( accumulator , element ) <EOL> result . add ( accumulator ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character and current accumulator value that starts with [initial] value.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.runningFold
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R > CharSequence . runningFoldIndexed ( initial : R , operation : ( index : Int , acc : R , Char ) -> R ) : List < R >

{ <EOL> if ( isEmpty ( ) ) return listOf ( initial ) <EOL> val result = ArrayList < R > ( length + <NUM_LIT:1> ) . apply { add ( initial ) } <EOL> var accumulator = initial <EOL> for ( index in indices ) { <EOL> accumulator = operation ( index , accumulator , this [ index ] ) <EOL> result . add ( accumulator ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character, its index in the original char sequence and current accumulator value that starts with [initial] value.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes the index of a character, current accumulator value
 * and the character itself, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.runningFold
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . runningReduce ( operation : ( acc : Char , Char ) -> Char ) : List < Char >

{ <EOL> if ( isEmpty ( ) ) return emptyList ( ) <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> val result = ArrayList < Char > ( length ) . apply { add ( accumulator ) } <EOL> for ( index in <NUM_LIT:1> until length ) { <EOL> accumulator = operation ( accumulator , this [ index ] ) <EOL> result . add ( accumulator ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character and current accumulator value that starts with the first character of this char sequence.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.runningReduce
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun CharSequence . runningReduceIndexed ( operation : ( index : Int , acc : Char , Char ) -> Char ) : List < Char >

{ <EOL> if ( isEmpty ( ) ) return emptyList ( ) <EOL> var accumulator = this [ <NUM_LIT:0> ] <EOL> val result = ArrayList < Char > ( length ) . apply { add ( accumulator ) } <EOL> for ( index in <NUM_LIT:1> until length ) { <EOL> accumulator = operation ( index , accumulator , this [ index ] ) <EOL> result . add ( accumulator ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character, its index in the original char sequence and current accumulator value that starts with the first character of this char sequence.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes the index of a character, current accumulator value
 * and the character itself, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.runningReduce
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R > CharSequence . scan ( initial : R , operation : ( acc : R , Char ) -> R ) : List < R >

{ <EOL> return runningFold ( initial , operation ) <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character and current accumulator value that starts with [initial] value.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.scan
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public inline fun < R > CharSequence . scanIndexed ( initial : R , operation : ( index : Int , acc : R , Char ) -> R ) : List < R >

{ <EOL> return runningFoldIndexed ( initial , operation ) <EOL> }

/**
 * Returns a list containing successive accumulation values generated by applying [operation] from left to right
 * to each character, its index in the original char sequence and current accumulator value that starts with [initial] value.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting list.
 *
 * @param [operation] function that takes the index of a character, current accumulator value
 * and the character itself, and calculates the next accumulator value.
 *
 * @sample samples.collections.Collections.Aggregates.scan
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public inline fun CharSequence . sumBy ( selector : ( Char ) -> Int ) : Int

{ <EOL> var sum : Int = <NUM_LIT:0> <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }

/**
 * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public inline fun CharSequence . sumByDouble ( selector : ( Char ) -> Double ) : Double

{ <EOL> var sum : Double = <NUM_LIT:0.0> <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . sumOf ( selector : ( Char ) -> Double ) : Double

{ <EOL> var sum : Double = <NUM_LIT:0> . toDouble ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . sumOf ( selector : ( Char ) -> Int ) : Int

{ <EOL> var sum : Int = <NUM_LIT:0> . toInt ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . sumOf ( selector : ( Char ) -> Long ) : Long

{ <EOL> var sum : Long = <NUM_LIT:0> . toLong ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . sumOf ( selector : ( Char ) -> UInt ) : UInt

{ <EOL> var sum : UInt = <NUM_LIT:0> . toUInt ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ OptIn ( kotlin . experimental . ExperimentalTypeInference :: class ) <EOL> @ OverloadResolutionByLambdaReturnType <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ WasExperimental ( ExperimentalUnsignedTypes :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun CharSequence . sumOf ( selector : ( Char ) -> ULong ) : ULong

{ <EOL> var sum : ULong = <NUM_LIT:0> . toULong ( ) <EOL> for ( element in this ) { <EOL> sum += selector ( element ) <EOL> } <EOL> return sum <EOL> }


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun CharSequence . chunked ( size : Int ) : List < String >

{ <EOL> return windowed ( size , size , partialWindows = true ) <EOL> }

/**
 * Splits this char sequence into a list of strings each not exceeding the given [size].
 *
 * The last string in the resulting list may have fewer characters than the given [size].
 *
 * @param size the number of elements to take in each string, must be positive and can be greater than the number of elements in this char sequence.
 *
 * @sample samples.text.Strings.chunked
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun < R > CharSequence . chunked ( size : Int , transform : ( CharSequence ) -> R ) : List < R >

{ <EOL> return windowed ( size , size , partialWindows = true , transform = transform ) <EOL> }

/**
 * Splits this char sequence into several char sequences each not exceeding the given [size]
 * and applies the given [transform] function to an each.
 *
 * @return list of results of the [transform] applied to an each char sequence.
 *
 * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.
 * You should not store it or allow it to escape in some way, unless you made a snapshot of it.
 * The last char sequence may have fewer characters than the given [size].
 *
 * @param size the number of elements to take in each char sequence, must be positive and can be greater than the number of elements in this char sequence.
 *
 * @sample samples.text.Strings.chunkedTransform
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun CharSequence . chunkedSequence ( size : Int ) : Sequence < String >

{ <EOL> return chunkedSequence ( size ) { it . toString ( ) } <EOL> }

/**
 * Splits this char sequence into a sequence of strings each not exceeding the given [size].
 *
 * The last string in the resulting sequence may have fewer characters than the given [size].
 *
 * @param size the number of elements to take in each string, must be positive and can be greater than the number of elements in this char sequence.
 *
 * @sample samples.collections.Collections.Transformations.chunked
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun < R > CharSequence . chunkedSequence ( size : Int , transform : ( CharSequence ) -> R ) : Sequence < R >

{ <EOL> return windowedSequence ( size , size , partialWindows = true , transform = transform ) <EOL> }

/**
 * Splits this char sequence into several char sequences each not exceeding the given [size]
 * and applies the given [transform] function to an each.
 *
 * @return sequence of results of the [transform] applied to an each char sequence.
 *
 * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.
 * You should not store it or allow it to escape in some way, unless you made a snapshot of it.
 * The last char sequence may have fewer characters than the given [size].
 *
 * @param size the number of elements to take in each char sequence, must be positive and can be greater than the number of elements in this char sequence.
 *
 * @sample samples.text.Strings.chunkedTransformToSequence
 */


public inline fun CharSequence . partition ( predicate : ( Char ) -> Boolean ) : Pair < CharSequence , CharSequence >

{ <EOL> val first = StringBuilder ( ) <EOL> val second = StringBuilder ( ) <EOL> for ( element in this ) { <EOL> if ( predicate ( element ) ) { <EOL> first . append ( element ) <EOL> } else { <EOL> second . append ( element ) <EOL> } <EOL> } <EOL> return Pair ( first , second ) <EOL> }

/**
 * Splits the original char sequence into pair of char sequences,
 * where *first* char sequence contains characters for which [predicate] yielded `true`,
 * while *second* char sequence contains characters for which [predicate] yielded `false`.
 *
 * @sample samples.text.Strings.partition
 */


public inline fun String . partition ( predicate : ( Char ) -> Boolean ) : Pair < String , String >

{ <EOL> val first = StringBuilder ( ) <EOL> val second = StringBuilder ( ) <EOL> for ( element in this ) { <EOL> if ( predicate ( element ) ) { <EOL> first . append ( element ) <EOL> } else { <EOL> second . append ( element ) <EOL> } <EOL> } <EOL> return Pair ( first . toString ( ) , second . toString ( ) ) <EOL> }

/**
 * Splits the original string into pair of strings,
 * where *first* string contains characters for which [predicate] yielded `true`,
 * while *second* string contains characters for which [predicate] yielded `false`.
 *
 * @sample samples.text.Strings.partition
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun CharSequence . windowed ( size : Int , step : Int = <NUM_LIT:1> , partialWindows : Boolean = false ) : List < String >

{ <EOL> return windowed ( size , step , partialWindows ) { it . toString ( ) } <EOL> }

/**
 * Returns a list of snapshots of the window of the given [size]
 * sliding along this char sequence with the given [step], where each
 * snapshot is a string.
 *
 * Several last strings may have fewer characters than the given [size].
 *
 * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.
 * @param size the number of elements to take in each window
 * @param step the number of elements to move the window forward by on an each step, by default 1
 * @param partialWindows controls whether or not to keep partial windows in the end if any,
 * by default `false` which means partial windows won't be preserved
 *
 * @sample samples.collections.Sequences.Transformations.takeWindows
 */