CharArray

A fixed-size, mutable array of Char values.

Indices start at zero and end at size - 1. Changing an element does not change the array length. Equality compares array identity, not element contents.

The size-only constructor fills every element with '\u0000'. The initializer constructor calls its callback once for each index, in ascending order.

Constructors

Link copied to clipboard
constructor(size: Int)

Creates an array with size elements, each initially '\u0000'.

constructor(size: Int, init: (Int) -> Char)

Creates an array by invoking init once for each index in ascending order.

Properties

Link copied to clipboard
external val size: Int

The number of elements in this array; always non-negative and unchanged after creation.

Functions

Link copied to clipboard
external fun CharArray.concatToString(startIndex: Int, endIndex: Int): String
Link copied to clipboard
external fun CharArray.copyInto(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): CharArray

Copies this range into destination, supporting overlapping ranges, and returns it.

Link copied to clipboard
external fun CharArray.copyOf(): CharArray

Returns a new array containing the same elements.

external fun CharArray.copyOf(newSize: Int): CharArray

Returns a resized copy, padding extra elements with zero characters.

Link copied to clipboard
operator external fun get(index: Int): Char

Returns the element at index.

Link copied to clipboard
operator external fun iterator(): CharIterator

Structural declaration for direct array loops; stored iterators are not executable.

Link copied to clipboard
operator external fun set(index: Int, value: Char)

Replaces the element at index with value.