class String
source · line 4public class String : Compare<String>, Add<String, String>, Equals<String>, ToString, Hash, Iterable<Char>
- Supertype
Compare<String> - Supertype
Add<String, String> - Supertype
Equals<String> - Supertype
ToString - Supertype
Hash - Supertype
Iterable<Char>
Immutable UTF-8 text.
Extensions
public fun String.startsWith(prefix: Char): Boolean· scoop:scoop.std:0.1.0public fun String.toULongOrNone(radix: Int = 10): ULong?· scoop:scoop.std:0.1.0public fun String.substringBefore(delimiter: Char, missingDelimiterValue: String = this): String· scoop:scoop.std:0.1.0public fun String.isNotBlank(predicate: (Char) -> Boolean): Boolean· scoop:scoop.std:0.1.0public fun String.trimStart(): String· scoop:scoop.std:0.1.0public fun String.substring(startIndex: Long, endIndex: Long = this.charLength): String· scoop:scoop.std:0.1.0public fun String.hexToByteArray(): Array<Byte>· scoop:scoop.std:0.1.0public fun String.toUShort(radix: Int = 10): UShort· scoop:scoop.std:0.1.0@Unsafe public fun <R> String.withUtf8Bytes(block: (Ptr<UInt8>, Long) -> R): R· scoop:scoop.core:0.1.0public fun String.toDouble(): Double· scoop:scoop.std:0.1.0public operator fun String.contains(value: String): Boolean· scoop:scoop.std:0.1.0public fun String.toUByteOrNone(radix: Int = 10): UByte?· scoop:scoop.std:0.1.0public fun String.toShort(radix: Int = 10): Short· scoop:scoop.std:0.1.0public fun String.toBigIntegerOrNone(radix: Int = 10): BigInteger?· scoop:scoop.math:0.1.0public fun String.removeSuffix(suffix: String): String· scoop:scoop.std:0.1.0public fun String.removePrefix(prefix: String): String· scoop:scoop.std:0.1.0public fun String.lowercaseAscii(): String· scoop:scoop.std:0.1.0public fun String.lineSequence(): Sequence<String>· scoop:scoop.std:0.1.0public fun String.endsWith(suffix: String): Boolean· scoop:scoop.std:0.1.0public fun String.isNotBlank(): Boolean· scoop:scoop.std:0.1.0public fun String.toByte(radix: Int = 10): Byte· scoop:scoop.std:0.1.0public fun String.toLong(radix: Int = 10): Long· scoop:scoop.std:0.1.0public fun String.trimEnd(predicate: (Char) -> Boolean): String· scoop:scoop.std:0.1.0public fun String.toRegexOrNone(options: Set<RegexOption> = emptySet()): Regex?· scoop:scoop.regex:0.1.0public fun String.toRegex(options: Set<RegexOption> = emptySet()): Regex· scoop:scoop.regex:0.1.0public fun String.toFloat(): Float· scoop:scoop.std:0.1.0public fun String.toUInt(radix: Int = 10): UInt· scoop:scoop.std:0.1.0public fun String.toByteOrNone(radix: Int = 10): Byte?· scoop:scoop.std:0.1.0public fun String.toBigInteger(radix: Int = 10): BigInteger· scoop:scoop.math:0.1.0@Unsafe public fun <R> String.withCString(block: (Ptr<Int8>) -> R): R· scoop:scoop.core:0.1.0public fun String.toIntOrNone(radix: Int = 10): Int?· scoop:scoop.std:0.1.0public fun String.lastIndexOf(value: Char, startIndex: Long = this.charLength): Long· scoop:scoop.std:0.1.0public fun String.indexOf(value: String, startIndex: Long = 0L): Long· scoop:scoop.std:0.1.0public fun String.toBooleanStrict(): Boolean· scoop:scoop.std:0.1.0public fun String.split(delimiter: String, limit: Long = 0L): List<String>· scoop:scoop.std:0.1.0public fun String.toInt(radix: Int = 10): Int· scoop:scoop.std:0.1.0public fun String.trimStart(predicate: (Char) -> Boolean): String· scoop:scoop.std:0.1.0public fun String.isBlank(predicate: (Char) -> Boolean): Boolean· scoop:scoop.std:0.1.0public fun String.trimEnd(): String· scoop:scoop.std:0.1.0public fun String.endsWith(suffix: Char): Boolean· scoop:scoop.std:0.1.0public fun String.trim(predicate: (Char) -> Boolean): String· scoop:scoop.std:0.1.0public fun String.toULong(radix: Int = 10): ULong· scoop:scoop.std:0.1.0public operator fun String.contains(value: Char): Boolean· scoop:scoop.std:0.1.0public fun String.hexToByteArrayOrNone(): Array<Byte>?· scoop:scoop.std:0.1.0public fun String.toBigDecimal(): BigDecimal· scoop:scoop.math:0.1.0public fun String.toFloatOrNone(): Float?· scoop:scoop.std:0.1.0public fun String.padEnd(length: Long, paddingChar: Char = ' '): String· scoop:scoop.std:0.1.0public fun String.substringAfter(delimiter: String, missingDelimiterValue: String = this): String· scoop:scoop.std:0.1.0public fun String.trim(): String· scoop:scoop.std:0.1.0public fun String.utf8Slice(range: Utf8Range): String· scoop:scoop.window:0.1.0public fun String.toUByte(radix: Int = 10): UByte· scoop:scoop.std:0.1.0public fun String.toLongOrNone(radix: Int = 10): Long?· scoop:scoop.std:0.1.0public fun String.indexOf(value: Char, startIndex: Long = 0L): Long· scoop:scoop.std:0.1.0public fun String.split(delimiter: Char, limit: Long = 0L): List<String>· scoop:scoop.std:0.1.0public fun String.toBooleanStrictOrNone(): Boolean?· scoop:scoop.std:0.1.0public fun String.toDoubleOrNone(): Double?· scoop:scoop.std:0.1.0public fun String.isBlank(): Boolean· scoop:scoop.std:0.1.0public fun String.padStart(length: Long, paddingChar: Char = ' '): String· scoop:scoop.std:0.1.0public fun String.substringBefore(delimiter: String, missingDelimiterValue: String = this): String· scoop:scoop.std:0.1.0public fun String.replace(oldValue: String, newValue: String): String· scoop:scoop.std:0.1.0public fun String.toUShortOrNone(radix: Int = 10): UShort?· scoop:scoop.std:0.1.0public fun String.toBigDecimalOrNone(): BigDecimal?· scoop:scoop.math:0.1.0public fun String.lines(): List<String>· scoop:scoop.std:0.1.0public fun String.toShortOrNone(radix: Int = 10): Short?· scoop:scoop.std:0.1.0public fun String.repeat(count: Long): String· scoop:scoop.std:0.1.0public fun String.substringAfter(delimiter: Char, missingDelimiterValue: String = this): String· scoop:scoop.std:0.1.0public fun String.startsWith(prefix: String): Boolean· scoop:scoop.std:0.1.0public fun String.replaceFirst(oldValue: String, newValue: String): String· scoop:scoop.std:0.1.0public fun String.uppercaseAscii(): String· scoop:scoop.std:0.1.0public fun String.replaceFirst(oldValue: Char, newValue: Char): String· scoop:scoop.std:0.1.0public fun String.toUIntOrNone(radix: Int = 10): UInt?· scoop:scoop.std:0.1.0public fun String.lastIndexOf(value: String, startIndex: Long = this.charLength): Long· scoop:scoop.std:0.1.0public fun String.replace(oldValue: Char, newValue: Char): String· scoop:scoop.std:0.1.0
function iterator
source · line 71public override operator fun iterator(): Iterator<Char>
- Overrides
iterator· Iterable
Traverses Unicode scalars in order without repeatedly rescanning from the beginning.
function plus
source · line 28@Intrinsic("string_concat")
public override operator fun plus(other: String): String
- Overrides
plus· Add
Concatenates the two immutable UTF-8 strings.
parameter other
source · line 29other: String
property byteLength
source · line 8public val byteLength: Long
get: public read-only
The UTF-8 byte count, available in constant time.
getter get
source · line 8get(): Long
function toCharArray
source · line 76public fun toCharArray(): Array<Char>
Copies Unicode scalars into an immutable character array.
function hash
source · line 44public override fun hash(): Long
- Overrides
hash· Hash
Returns a hash consistent with exact string equality.
function equals
source · line 18public override operator fun equals(other: String): Boolean
- Overrides
equals· Equals
Compares text exactly, without Unicode normalization or case folding.
parameter other
source · line 18other: String
function toMutableByteArray
source · line 97public fun toMutableByteArray(): MutableArray<Byte>
Copies the UTF-8 encoding into an independently mutable byte array.
function compareTo
source · line 34@Intrinsic("string_compare_to")
public override operator fun compareTo(other: String): Long
- Overrides
compareTo· Compare
Compares strings lexicographically using their Unicode text order.
parameter other
source · line 35other: String
function slice
source · line 61public fun slice(start: Long, endExclusive: Long): String
Returns the scalar-indexed half-open range from start to endExclusive. Invalid bounds
throw IndexOutOfBoundsException; an empty range is allowed.
parameter endExclusive
source · line 61endExclusive: Long
parameter start
source · line 61start: Long
function toString
source · line 40public override fun toString(): String
- Overrides
toString· ToString
Returns this immutable string.
function toMutableCharArray
source · line 84public fun toMutableCharArray(): MutableArray<Char>
Copies Unicode scalars into independently mutable character slots.
function toByteArray
source · line 92public fun toByteArray(): Array<Byte>
Copies the UTF-8 encoding into an immutable byte array without a NUL terminator.
function getCharAt
source · line 51public fun getCharAt(idx: Long): Char
Returns the Unicode scalar at a zero-based scalar index by scanning from the beginning, taking O(byteLength) time in the worst case. An invalid index throws IndexOutOfBoundsException. Use iteration for a complete sequential traversal.
parameter idx
source · line 51idx: Long
property charLength
source · line 13public val charLength: Long
get: public read-only
The number of Unicode scalar values, computed in O(byteLength) time by scanning UTF-8. Combining marks count separately.
getter get
source · line 13get(): Long