Language Reference

Strings

Work with text using natural checks, prefixes, and readable concatenation.

String tools

  • Use quotes for literals.
  • Concatenate with +.
  • Check prefixes and suffixes.

String literals and escapes

Wrap text in quotes. Escape quotes and newlines with backslashes.

strings.pln
set title to "Plain Language"
set quote to "She said \"hello\""
set message to "Line one\nLine two"

Say shortcuts

say treats plain words as text, so you can speak quickly without extra quotes.

say.pln
say hello there
say "System online"
print total
say value of total

Concatenation and casting

Join strings with +. Use str() when mixing in numbers or booleans.

concat.pln
set first_name to "Ada"
set last_name to "Lovelace"
set visits to 3
set full_name to first_name + " " + last_name
set line to "Hello, " + full_name + " (" + str(visits) + " visits)"
print line

String checks

Use readable checks for empty strings, prefixes, and suffixes.

checks.pln
if name is empty then return "Missing name"
if filename ends with ".json" then print "JSON file"
if handle starts with "vip-" then print "Priority user"

Length and indexing

Strings behave like sequences, so you can measure and index them.

length.pln
set name to "Atlas"
set first_letter to name[0]
set length to len(name)
print "First letter: " + first_letter
print "Length: " + str(length)

Splitting and joining

Plain Language transpiles to Python, so Python string methods like split and join are available when you need them.

split_join.pln
set line to "alpha, beta, gamma"
set tags to line.split(", ")
set compact to "-".join(tags)
print compact

Tutorial: normalize user input

Clean up input with Python string helpers, then guard against empty values.

normalize.pln
set raw_name to ask "Enter your name"
set name to raw_name.strip()
if name is empty then do
    print "Name required"
    exit

set display to name.title()
print "Welcome, " + display

Tutorial: build a slug

Create URL-friendly text with lowercasing and simple replacements.

slug.pln
set headline to "Fast Start Guide"
set slug to headline.lower().replace(" ", "-")
print slug

Readable formatting

  • Prefer explicit concatenation so outputs stay predictable.
  • Convert non-strings with str() before joining.
  • Normalize comparisons with lower() when case does not matter.
  • Store shared phrases in variables to keep copy consistent.