ludic/docs/language/text/text-char_at.md
Orkuncakilkaya b7745a4600 refactor(lang): rename the str type (and stringify builtin) to string
Expand the abbreviated string type and its conversion builtin to the full
word everywhere:
  str            ->  string        (the immutable-string type)
  str(x) -> str  ->  string(x) -> string   (the stringify builtin;
                                            what `{…}` interpolation calls)

Types are recognized by identifier, and llty maps both spellings to LLVM
`ptr`, so this is an atomic source rewrite: type annotations, the Ludic
type tags, the builtin name/dispatch, and the interpolation desugar, plus
the grammars, LSP, docs (type-str -> type-string, fn-str -> fn-string), and
inventory. int/bool stay (universally accepted, like Math).

Reseeded; C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-30 01:51:11 +03:00

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 from
  • i — the zero-based byte index
program FirstIsDigit {
  var entry: string = "7up"

  handler Check phase Update {
    let c = Text.char_at(entry, 0)
    let is_digit = c >= 48 and c <= 57   # true: '7'
  }
}