String.opIndexAssign

Assigns a value to the character with the index pos.

  1. char opIndexAssign(char value, size_t pos)
    struct String
    ref @nogc nothrow pure @safe
    char
    opIndexAssign
    (
    const char value
    ,
    const size_t pos
    )
  2. ByCodeUnit!char opIndexAssign(ByCodeUnit!R value)
  3. ByCodeUnit!char opIndexAssign(char value)
  4. ByCodeUnit!char opIndexAssign(char[] value)

Parameters

value char

Value.

pos size_t

Position.

Return Value

Type: char

Assigned value.

Precondition: length > pos.

Examples

auto s = String("alea iacta est.");

s[0] = 'A';
assert(s[0] == 'A');

Meta