chunk
Commons
stable
Splits a string into an array of fixed-size substrings. Used internally to segment colour codes and similar fixed-width token sequences.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- strrequisstring
- The source string to split.
- sizenumber1
- The length of each chunk. Defaults to 1 (individual characters).
API
Valeur de retour
La valeur retournée par cet util.
- An array of substrings of the given size. The last element may be shorter if the string length is not divisible by size.
Usage
Exemples
Extraits de code prêts à coller.
Split a hex colour into pairs