Documents for @litert/utils-string
    Preparing search index...

    Function toChunksBackward

    • This function splits a string into chunks of specified size. Different from toChunks, this function reverses the order of the chunks, which means the first chunk will contain the last characters of the string, when the input string is not a multiple of the chunk size,

      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.

      `toChunksBackward('abcdefghij', 3) -> ['a', 'bcd', 'efg', 'hij']`