@unikue/ts-lang-utils
    Preparing search index...

    Function removeFirst

    • Returns the string that removed the first occurrence in the given text

      Parameters

      • Optionaltext: string | null

        The text to inspect

      • Optionalsearch: string | RegExp | null

        The string or regex to match

      Returns string | null | undefined

      the string that removed the first occurrence in the given text

      David Hsing

      removeFirst(undefined, undefined);    // undefined
      removeFirst('foobar-foobar', undefined); // 'foobar-foobar'
      removeFirst('foobar-foobar', 'bar'); // 'foo-foobar'