PokéRogue
    Preparing search index...

    Function chunkString

    • Chunk a string into an array, creating a new element every length characters.

      Parameters

      • str: string

        The string to chunk

      • length: number

        The length of each chunk; should be a non-negative integer

      Returns string[]

      The result of splitting str after every instance of length characters.

      console.log(chunkString("123456789abc", 4)); // Output: ["1234", "5678", "9abc"]
      console.log(chunkString("1234567890", 4)); // Output: ["1234", "5678", "90"]