@jiminp/tooltool
    Preparing search index...

    Function substringAfter

    • Returns the substring after the first occurrence of the delimiter.

      Type Parameters

      • T extends string | null = null

      Parameters

      • s: Nullish

        Input string, null, or undefined.

      • delimiter: string | RegExp

        String or regex marking where to start.

      • Optionalon_missing: T

        Returned if s is nullish or delimiter not found (default: null).

      Returns T

      The substring after the delimiter (may be empty string), or on_missing.

      A delimiter at the end returns an empty string, not on_missing; an empty delimiter returns all of s. Useful for removing a path, field, or protocol prefix. Regex flags are preserved; matching starts at zero without reading or changing the caller's lastIndex. Global regexes use the first match; sticky regexes must match at zero.

      substringAfter("path/to/file.txt", '/');     // "to/file.txt"
      substringAfter("abc123xyz", /\d+/); // "xyz"
      substringAfter("abc123", /\d+/); // "" (empty string)
      substringAfter(undefined, ':'); // null
      substringAfter("no-needle", ':', 'default'); // 'default'
    • Returns the substring after the first occurrence of the delimiter.

      Type Parameters

      • T extends string | null = null

      Parameters

      • s: Nullable<string>

        Input string, null, or undefined.

      • delimiter: string | RegExp

        String or regex marking where to start.

      • Optionalon_missing: T

        Returned if s is nullish or delimiter not found (default: null).

      Returns string | T

      The substring after the delimiter (may be empty string), or on_missing.

      A delimiter at the end returns an empty string, not on_missing; an empty delimiter returns all of s. Useful for removing a path, field, or protocol prefix. Regex flags are preserved; matching starts at zero without reading or changing the caller's lastIndex. Global regexes use the first match; sticky regexes must match at zero.

      substringAfter("path/to/file.txt", '/');     // "to/file.txt"
      substringAfter("abc123xyz", /\d+/); // "xyz"
      substringAfter("abc123", /\d+/); // "" (empty string)
      substringAfter(undefined, ':'); // null
      substringAfter("no-needle", ':', 'default'); // 'default'