Documents for @litert/utils-string
    Preparing search index...
    • This function splits a string into chunks of specified size. If the string length is not a multiple of the chunk size, the last chunk will contain the remaining characters.

      Parameters

      • text: string

        The string to be split into chunks.

      • chunkSize: number

        The size of each chunk. Must be a positive integer.

      Returns string[]

      An array of strings, each representing a chunk of the original string.

      RangeError if the chunk size is not a positive integer.

      `toChunks('abcdefghij', 3) -> ['abc', 'def', 'ghi', 'j']`