• Returns a substring of the string starting from the left.

    strLeft() extracts the number of characters from left of the string up to the count. In particular:

    • If count is less than zero, strLeft() returns an empty string.
    • If count is less than value.length', strLeft() returns a new string with the count` number of characters from the left of the string.
    • If count is greater than value.length, then the value original value is returned.

    Any argument value that is NaN is treated as if it were 0.

    Parameters

    • value: string

      The string value to return the substring from.

    • count: number

      The number of characters to extract

    Returns string

    The substring based on the count number of characters from the right

    Since

    0.4.2

    Example

    strLeft("Nevware21", -1); // ""
    strLeft("Nevware21", 0); // ""
    strLeft("Nevware21", 1); // "N"
    strLeft("Nevware21", 3); // "Nev"
    strLeft("Nevware21", 21); // "Nevware21"