API Reference › Unicode › Unicode.chars
method

Unicode.chars

Unicode.chars(s) -> []int

Decodes the whole string into a []int of code points, in order — the iteration primitive for laying out glyphs, scanning text, or transforming character by character without byte-fiddling.

Parameters

sthe UTF-8 string

Example

program Chars {
  entry {
    let cs = Unicode.chars("hi")
    var i = 0
    while i < len(cs) { print(cs[i]); i = i + 1 }   # 104, 105
  }
}
← All symbols