• Returns the substring before the first occurrence of the given separator (the separator is not returned)

    Parameters

    • Optionaltext: null | string

      the string to get a substring from

    • Optionalseparator: null | string

      the String to search for

    Returns string | undefined

    the substring before the first occurrence of the given separator

    substringBefore("foo/bar/foo/bar", "/");    // 'foo'