Edit

kc3-lang/kc3/doc/1_KC3/1.03_Str.en.md

Branch :

  • doc/1_KC3/1.03_Str.en.md
  • # 1.03 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.03.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.03.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
    ```