863 B
863 B
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| text-char_at | Text.char_at | text | namespace-method | Text.char_at | Text.char_at(s, i) -> int | The byte value at an index, 0..255. | 1 | Text | char_at |
Returns the byte at position i in s as an int in the range 0..255 — for example Text.char_at("hello", 0) is 104, the code for h. Indices are zero-based and count bytes. Use it to inspect or classify individual characters, such as testing whether a key of input is a digit.
Parameters:
s— the string to read fromi— the zero-based byte index
program FirstIsDigit {
let entry: string = "7up"
handler Check phase Update {
let c = Text.char_at(entry, 0)
let is_digit = c >= 48 and c <= 57 # true: '7'
}
}