Hash :
ce10e043
Author :
Thomas de Grivel
Date :
2025-05-19T12:47:56
Translate using ChatGPT
Read-only string of bytes. Use Str.size to get the size in bytes
of the string (without NUL terminator). All KC3 strings are bound-
checked according to their size and are NUL terminated.
A string litteral starts and ends with double quotes "
or triple quotes """ and inside of a string litteral you can use
the #{expr} syntax to evaluate expr to a Str inside of the
litteral. The string litteral is then parsed as a Call to KC3.str
and not an actual Str. At evaluation the arguments to the call
and KC3.str gets called concatenating at once all the parts to a
brand new Str.
ikc3> "123"
"123"
ikc3> type("123")
Str
ikc3> b = 2
2
ikc3> "1#{b}3"
"123"
ikc3> type("1#{b}3")
Str
ikc3> quote "1#{b}3"
"1#{b}3"
ikc3> type(quote "1#{b}3")
Call
ikc3> type(quote quote "1#{b}3")
Quote
Top : KC3 documentation
Previous : 1.19 Ratio
Next : 1.21 Struct
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# 1.20 Str type
Read-only string of bytes. Use `Str.size` to get the size in bytes
of the string (without NUL terminator). All KC3 strings are bound-
checked according to their size and are NUL terminated.
## 1.20.1 String litterals and interpolation
A string litteral starts and ends with double quotes `"`
or triple quotes `"""` and inside of a string litteral you can use
the `#{expr}` syntax to evaluate `expr` to a `Str` inside of the
litteral. The string litteral is then parsed as a `Call` to `KC3.str`
and not an actual `Str`. At evaluation the arguments to the call
and `KC3.str` gets called concatenating at once all the parts to a
brand new `Str`.
## 1.20.2 Examples
```elixir
ikc3> "123"
"123"
ikc3> type("123")
Str
ikc3> b = 2
2
ikc3> "1#{b}3"
"123"
ikc3> type("1#{b}3")
Str
ikc3> quote "1#{b}3"
"1#{b}3"
ikc3> type(quote "1#{b}3")
Call
ikc3> type(quote quote "1#{b}3")
Quote
```
---
Top : [KC3 documentation](../)
Previous : [1.19 Ratio](1.19_Ratio)
Next : [1.21 Struct](1.21_Struct)