GString.opIndex

Returns the i'th displayable character (Grapheme) within the GString.

Complexity: O(i). Each Grapheme is composed of a variable number of code-points, and code-poinst are composed of a variable number of characters (code-units).

  1. Grapheme opIndex(size_t i)
    struct GString(CharT)
    Grapheme
    opIndex
    (
    size_t i
    )
    if (
    isSomeChar!CharT
    )
  2. Grapheme[] opIndex()
  3. Grapheme[] opIndex(size_t[2] slice)

Examples

auto t1 = typeof(this)("Test R̆ȧm͆b̪õ.");
assert(t1[3].length == 1);
assert(t1[3][0] == 't');
assert(t1[5].length == 2);
assert(t1[5][0] == 'R' && t1[5][1] == '\u0306');
assert(t1[6].length == 2);
assert(t1[6][0] == 'a' && t1[6][1] == '\u0307');

Meta