String Manipulation
Common operations
LEN("hello") = 5 # length
"hello"[0] = "h" # index (zero-based)
"computer".SUBSTRING(0,4) = "comp" # extract part
"data" + "base" = "database" # concatenation
UPPER("hi") = "HI"
LOWER("Hi") = "hi"
str(15) = "15" # int → string
int("15") = 15 # string → int
Worked example
name ← "Ada Lovelace"
OUTPUT LEN(name) # 12 (the space counts!)
OUTPUT name[0] # A
OUTPUT UPPER(name) # ADA LOVELACE
Looping through a string
FOR i ← 0 TO LEN(word) - 1
OUTPUT word[i]
NEXT i
Exam tip
Spaces and punctuation count towards length. Indexing usually starts at 0, so the first character is position 0 and the last is length − 1.