resize-string ( n str -- newstr ) (original) (raw)

resize-string ( n str -- newstr )
Factor handbook » The language » Collections » Strings

Prev: 1string ( ch -- str )

Vocabulary
strings

Inputs

n a non-negative integer
str a string

Outputs

newstr a string

Word description
Resizes the string to have a length of n elements. When making the string shorter, this word may either create a new string or modify the existing string in place. When making the string longer, this word always allocates a new string, filling remaining space with zeroes.

Side effects
Modifies str

Definition

IN: strings

PRIMITIVE: resize-string ( n str -- newstr )