Tweakr
    Preparing search index...

    Function removeSuffix

    • Removes the specified suffix from a string if it exists.

      Parameters

      • str: string

        The string to process.

      • suffix: string

        The suffix to remove.

      • Optionaloptions: { caseInsensitive?: boolean }

      Returns string

      The string without the suffix if it was present; otherwise, returns the original string.

      1.1.0

      removeSuffix("running", "ing"); // "runn"
      removeSuffix("hello", "lo"); // "hel"
      removeSuffix("world", "ing"); // "world" (suffix not found)