Clean and combine player text
THE BASIC LANGUAGE
A player who types a direction with spaces or mixed capitalization probably means the same thing. Normalize the input before comparing it.
FUNCTION Run()
DIM raw = " WeSt "
DIM word = Lower(Trim(raw))
DIM report = Replace("Dial: ?", "?", word)
RETURN report
END FUNCTIONWhat you should see The result is Dial: west. Trim removes whitespace at the ends, Lower changes WeSt to west, and Replace fills the question mark.
| Upper / Lower | Convert the letter case for display or comparison. |
|---|---|
| Contains / StartsWith / EndsWith | Test a piece of text. An optional third Boolean chooses case sensitivity. |
| Split / Join | Split("red,blue", ",") produces two entries. Join(["red","blue"], " / ") produces the text red / blue. |
| StringLength | Count the length of a string. A zero-length answer can be given its own feedback before any other comparisons. |
