Function get

  • Negative indices count backwards from the beginning of the string.

    Remarks

    Non-integer or out of bounds indices return undefined.

    Example

    import * as S from "flurp/string";

    const third = S.get(2);
    const secondToLast = S.get(-2);
    third("abcdef"); // c
    secondToLast("abcdef"); // e

    Parameters

    • i: number

      the index

    Returns ((s: string) => undefined | string)

      • (s: string): undefined | string
      • Parameters

        • s: string

        Returns undefined | string