const words = (str: string, pattern: RegExp = /[^a-zA-Z-]+/) =>
        str.split(pattern).filter(Boolean);
      
      Typescript language logo

      Split string into words

      Codiga's TypeScript Recipes

      Converts a given string into an array of words.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.