API Reference › Text › Text.length
method

Text.length

Text.length(s) -> int

Returns how many bytes are in s, not counting the terminating zero. It is the same count as the bare len(s), exposed under the Text namespace for discoverability. Use it to size a HUD field, walk a string by index, or check for emptiness with Text.length(s) == 0.

Parameters

sthe string to measure

Example

program NameWidth {
  var label: string = "player one"

  handler Draw phase Render {
    let width = Text.length(label) * 6   # 6 px per glyph
  }
}
← All symbols