Runtime v2.81 · Updated Sep 30, 2026

String

Text value collection.

Syntax

String

This class cannot be constructed directly.

Parameters

None

Returns

—

Behavior / side effects

Text value collection. Created by string literals or str(value), then read by length/index/loop operations.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

name = "Start"
if name:
    first_char = name[0]
    text(first_char)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

None

Methods

24 methods

String.literal

Create text directly with single or double quotes.

Syntax

"hello"

Parameters

NameDescription
textString
String content between quotes.
Required · Positional or named
No default

Returns

String — A new string value.

Behavior / side effects

Create text directly with single or double quotes.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Start"
text(label)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.cast

Convert a number, boolean, or other value to text.

Syntax

str(value, /)

Parameters

NameDescription
valueAny?
Value to convert into text.
Required · Positional only
No default

Returns

String — Converted text value.

Behavior / side effects

Convert a number, boolean, or other value to text. Large or deeply nested structured values use a bounded preview with explicit omission markers, while a direct string remains unchanged.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

attempt = 3
line = str(attempt)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.length

Count how many characters are in the string.

Syntax

len(string, /)

Parameters

NameDescription
stringString
String value to count.
Required · Positional only
No default

Returns

Int — Character count.

Behavior / side effects

Count how many characters are in the string.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play"
count = len(label)        # returns 4

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.index_access

Read one character by index.

Syntax

string[index]

Parameters

NameDescription
stringString
Source string.
Required · Positional or named
No default
indexInt
Character index. Use -1 for the last character.
Required · Positional only
No default

Returns

String? — One-character string, or None if out of range.

Behavior / side effects

Read one character by index. Negative indexes count from the end.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play"
first = label[0]          # returns 'P'
last = label[-1]          # returns 'y'

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.slice

Copy a substring using Python-style slicing.

Syntax

string[start:end[:step]]

Parameters

NameDescription
startInt
First character index to include.
Optional · Positional only
Default: start of string
endInt
Stop before this character index.
Optional · Positional only
Default: end of string
stepInt
Distance between characters. Cannot be 0; negative values read backward.
Optional · Positional only
Default: 1

Returns

String — A new string slice, clamped to the available range.

Behavior / side effects

Copy a substring using Python-style slicing. Omitted bounds use the start or end; negative indexes count from the end.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "abcdef"
middle = label[1:4]       # returns 'bcd'
tail = label[-3:]         # returns 'def'
reverse = label[::-1]     # returns 'fedcba'

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.lower_method

Return a lowercase copy of the string.

Syntax

string.lower()

Parameters

None

Returns

String — Lowercase string.

Behavior / side effects

Return a lowercase copy of the string.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "PLAY"
text(label.lower())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.upper_method

Return an uppercase copy of the string.

Syntax

string.upper()

Parameters

None

Returns

String — Uppercase string.

Behavior / side effects

Return an uppercase copy of the string.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "play"
text(label.upper())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.strip_method

Trim whitespace, or the provided characters, from both ends.

Syntax

string.strip(chars=None, /)

Parameters

NameDescription
charsString?
Characters to trim instead of whitespace.
Optional · Positional only
Default: None

Returns

String — Trimmed string.

Behavior / side effects

Trim whitespace, or the provided characters, from both ends.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "  Play  "
clean = label.strip()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.lstrip_method

Trim whitespace, or the provided characters, from the left side.

Syntax

string.lstrip(chars=None, /)

Parameters

NameDescription
charsString?
Characters to trim instead of whitespace.
Optional · Positional only
Default: None

Returns

String — Left-trimmed string.

Behavior / side effects

Trim whitespace, or the provided characters, from the left side.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "...Play"
clean = label.lstrip(".")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.rstrip_method

Trim whitespace, or the provided characters, from the right side.

Syntax

string.rstrip(chars=None, /)

Parameters

NameDescription
charsString?
Characters to trim instead of whitespace.
Optional · Positional only
Default: None

Returns

String — Right-trimmed string.

Behavior / side effects

Trim whitespace, or the provided characters, from the right side.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play..."
clean = label.rstrip(".")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.startswith_method

Check whether the selected slice starts with a prefix.

Syntax

string.startswith(prefix, start=0, stop=len(string), /)

Parameters

NameDescription
prefixString
Prefix to test.
Required · Positional only
No default
startInt
Start index for the check.
Optional · Positional only
Default: 0
stopInt
Stop index for the check.
Optional · Positional only
Default: len(string)

Returns

Boolean — true when the prefix matches.

Behavior / side effects

Check whether the selected slice starts with a prefix.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play"
ready = label.startswith("Pl")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.endswith_method

Check whether the selected slice ends with a suffix.

Syntax

string.endswith(suffix, start=0, stop=len(string), /)

Parameters

NameDescription
suffixString
Suffix to test.
Required · Positional only
No default
startInt
Start index for the check.
Optional · Positional only
Default: 0
stopInt
Stop index for the check.
Optional · Positional only
Default: len(string)

Returns

Boolean — true when the suffix matches.

Behavior / side effects

Check whether the selected slice ends with a suffix.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play"
ready = label.endswith("ay")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.find_method

Find the first substring index, or return -1 when absent.

Syntax

string.find(sub, start=0, stop=len(string), /)

Parameters

NameDescription
subString
Substring to find.
Required · Positional only
No default
startInt
Start index for the search.
Optional · Positional only
Default: 0
stopInt
Stop index for the search.
Optional · Positional only
Default: len(string)

Returns

Int — First matching index, or -1.

Behavior / side effects

Find the first substring index, or return -1 when absent.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "start button"
index = label.find("button")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.index_method

Find the first substring index and fail visibly when absent.

Syntax

string.index(sub, start=0, stop=len(string), /)

Parameters

NameDescription
subString
Substring that must exist.
Required · Positional only
No default
startInt
Start index for the search.
Optional · Positional only
Default: 0
stopInt
Stop index for the search.
Optional · Positional only
Default: len(string)

Returns

Int — First matching index.

Behavior / side effects

Find the first substring index and fail visibly when absent.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "start button"
index = label.index("button")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.replace_method

Return a copy with occurrences of old text replaced.

Syntax

string.replace(old, new, count=-1, /)

Parameters

NameDescription
oldString
Text to replace.
Required · Positional only
No default
newString
Replacement text.
Required · Positional only
No default
countInt
Maximum replacements; negative means all.
Optional · Positional only
Default: -1

Returns

String — Updated string copy.

Behavior / side effects

Return a copy with occurrences of old text replaced.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "start start"
once = label.replace("start", "play", 1)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.split_method

Split a string into a list of text parts.

Syntax

string.split(sep=None, maxsplit=-1, /)

Parameters

NameDescription
sepString?
Separator text. None splits on whitespace.
Optional · Positional only
Default: None
maxsplitInt
Maximum split count; negative means all.
Optional · Positional only
Default: -1

Returns

list — List of string parts.

Behavior / side effects

Split a string into a list of text parts.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

raw = "a,b,c"
parts = raw.split(",")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.join_method

Join an iterable of strings using this string as the separator.

Syntax

string.join(iterable, /)

Parameters

NameDescription
iterableIterable<String>
String values to join.
Required · Positional only
No default

Returns

String — Joined string.

Behavior / side effects

Join an iterable of strings using this string as the separator.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

parts = ["a", "b", "c"]
line = ",".join(parts)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.count_method

Count non-overlapping substring occurrences.

Syntax

string.count(sub, start=0, stop=len(string), /)

Parameters

NameDescription
subString
Substring to count.
Required · Positional only
No default
startInt
Start index for the count.
Optional · Positional only
Default: 0
stopInt
Stop index for the count.
Optional · Positional only
Default: len(string)

Returns

Int — Occurrence count.

Behavior / side effects

Count non-overlapping substring occurrences.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "banana"
count = label.count("an")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.isalpha_method

Check whether the string is non-empty and all characters are letters.

Syntax

string.isalpha()

Parameters

None

Returns

Boolean — true for letters only.

Behavior / side effects

Check whether the string is non-empty and all characters are letters.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

label = "Play"
ok = label.isalpha()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.isdigit_method

Check whether the string is non-empty and all characters are digits.

Syntax

string.isdigit()

Parameters

None

Returns

Boolean — true for digits only.

Behavior / side effects

Check whether the string is non-empty and all characters are digits.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

value = "123"
ok = value.isdigit()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.isalnum_method

Check whether the string is non-empty and all characters are letters or digits.

Syntax

string.isalnum()

Parameters

None

Returns

Boolean — true for letters or digits only.

Behavior / side effects

Check whether the string is non-empty and all characters are letters or digits.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

value = "A123"
ok = value.isalnum()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.isspace_method

Check whether the string is non-empty and all characters are whitespace.

Syntax

string.isspace()

Parameters

None

Returns

Boolean — true for whitespace only.

Behavior / side effects

Check whether the string is non-empty and all characters are whitespace.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

value = "   "
ok = value.isspace()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.for_loop

Iterate characters from left to right.

Syntax

for ch in string:

Parameters

NameDescription
chString
Current character in the loop.
Required · Positional or named
No default
stringString
String to iterate.
Required · Positional or named
No default

Returns

None — No direct return value. Executes once per character.

Behavior / side effects

Iterate characters from left to right.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

word = "Go"
for ch in word:
    text(ch)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

String.truthy_check

Check whether the string is empty or not.

Syntax

if string | if not string

Parameters

NameDescription
stringString
String used in the condition.
Required · Positional or named
No default

Returns

Boolean condition — true when non-empty, false when empty.

Behavior / side effects

Check whether the string is empty or not.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

value = ""
if not value:
    text("empty")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs