String! datatype

1. Abstract

A string! value is a sequence of Unicode code points, or char! values.

String! is a member of the following typesets: any-string!, default!, series!

2. Creation

String! values can be created using literal syntax, or at runtime by using a make constructor or to conversion.

>> s: make string! 100
== ""
>> to string! 'foo
== "foo"

>> to string! [bar]
== "bar"

>> to string! 42
== "42"

The native! values form and mold can also be used to convert a value to a user-friendly string or a source format string, respectively.

>> form 'foo
== "foo"
>> mold 'bar
== "bar"
Attempting to convert none by to conversion raises an error.

3. Literal syntax

Single-line string:

Zero or more characters enclosed in quotation marks.


Multi-line string:

Zero or more characters enclosed in opening and closing braces.


A single-line string cannot contain unescaped new-line characters.

>> cr
== #"^M"

>> lf
== #"^/"

>> crlf
== "^M^/"

A multi-line string can contain new-line characters, quotation marks, and paired braces. Unpaired braces must be escaped by preceding the character with ^, e.g. {foo^{}.

4. Comparisons

All comparators can be applied on string!: =, ==, <>, >, <, >=, <=, =?. In addition, min, and max are also supported.

5. Testing values

Use string? to check if a value is of the string! datatype.

>> string? "foo"
== true

Use type? to return the datatype of a given value.

>> type? "foo"
== string!

6. Pre-defined words

6.1. Actions

find, form, mold, pick, poke, put, read, select, trim

6.2. Functions

a-an, any-string?, ask, charset, clean-path, dirize, ellipsize-at, help-string, input, load, pad, string?, to-string

6.3. Natives

as, call, checksum, debase, dehex, difference, do, enbase, exclude, get-env, intersect, lowercase, parse, set-env, to-local-file, union, unique, uppercase

6.4. Routines

set-current-dir, write-clipboard, write-stdout

results matching ""

    No results matching ""