Tweakr
    Preparing search index...

    Function removeHonorificSuffix

    • Removes any known honorific suffix from the end of a string.

      This function checks the input string for honorific suffixes (e.g., "Jr.", "Sr.", "III") and removes the first match found. The input string is trimmed before processing, and the result is also trimmed.

      Parameters

      • str: string

        The string to remove the honorific suffix from.

      Returns string

      The string without the honorific suffix.

      1.2.0

      removeHonorificSuffix("John Doe Jr."); // Returns "John Doe"
      removeHonorificSuffix("Jane Smith"); // Returns "Jane Smith"