Text Utility
Text value operations. No hidden external Service communication.
Contract Text · 1.0.0-draft.1
Functions
size
Integer Unicode code-point count.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
Returns: core.integer
trim
Remove leading/trailing Unicode whitespace.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
Returns: core.string
lower
Locale-independent case conversion.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
Returns: core.string
upper
Locale-independent case conversion.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
Returns: core.string
contains
Boolean literal substring test.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| part | core.string | Yes | — |
Returns: core.boolean
startsWith
Boolean.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| part | core.string | Yes | — |
Returns: core.boolean
endsWith
Boolean.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| part | core.string | Yes | — |
Returns: core.boolean
split
Array of literal-separated parts, including empty parts. Empty separator fails.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| separator | core.string | Yes | — |
Returns: array<core.string>
join
Concatenated string; elements must be strings.
| Argument | Type | Required | Default |
|---|---|---|---|
| strings | Text.Strings | Yes | — |
| separator | core.string | Yes | — |
Returns: core.string
replace
Replace all literal occurrences; empty search fails.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| search | core.string | Yes | — |
| replacement | core.string | Yes | — |
Returns: core.string
slice
Checked code-point range.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| start | core.integer | Yes | — |
| count | core.integer | Yes | — |
Returns: core.string
escapeHtml
Escape text for insertion into HTML text content, not a URL or script context.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
Returns: core.string
format
String with {{path.to.value}} replacements. Missing paths fail; no expressions or code execute.
| Argument | Type | Required | Default |
|---|---|---|---|
| template | core.string | Yes | — |
| values | core.object | Yes | — |
Returns: core.string
matches
Full-string match using the portable pattern subset in this contract.
| Argument | Type | Required | Default |
|---|---|---|---|
| text | core.string | Yes | — |
| pattern | core.string | Yes | — |
Returns: core.boolean
Behavior
- Text operations use Unicode code points. Case conversion is locale-independent. Slicing checks the full range.
- Split and replace use literal separators; empty separators/search fail. Format replaces declared data paths and never evaluates code.
- Patterns support literals, classes, Unicode categories, dot, anchors, grouping, alternation and quantifiers. Backreferences, lookaround and implementation-specific flags are excluded.