String
Capy
type string
string stores text, raw bytes, and HTML literal results in Capy.
A string literal and an HTML literal both yield a string. Use variables, parameters, and return values directly. Functions can build and return HTML strings like other strings.
<?= value ?> escapes a string for HTML text, a quoted attribute, a script, or a style. <?: value ?> emits a string without escaping. Use raw interpolation only for source-controlled HTML text.
An HTML literal inside <?= ?> becomes escaped text. This double escape is expected. A dval cannot go directly in an HTML literal. Convert it with string() first.
Use length, find, contains, replace, lower, upper, and substr for common text work. Use split_utf8 when you must split UTF-8 text by characters.
Example
Capy
var name := "Ada" var page := <><p><?= upper(name) ?></p></> print(page, "\n")