Factor handbook » The language » Collections

Next:Byte arrays

The strings vocabulary implements a data type for storing text. Strings are represented as fixed-size mutable sequences of Unicode code points. Code points are represented as integers in the range [0, 2097152].

Strings implement the Sequence protocol, and basic string manipulation can be performed with Sequence operations from the sequences vocabulary. More text processing functionality can be found in vocabularies carrying the text tag.

Strings form a class:

string? ( object -- ? )

Creating new strings:
>string ( seq -- str )

<string> ( n ch -- string )

Creating a string from a single character:
1string ( ch -- str )

Resizing strings:
resize-string ( n str -- newstr )

See also
Character and string syntax, String buffers, Unicode support, I/O encodings