March Docs

String

String module: functions for working with UTF-8 encoded strings.

March strings are immutable UTF-8 byte sequences. The runtime uses a fat-pointer representation with small-string optimisation (SSO): strings of 15 bytes or fewer are stored inline without a heap allocation.

Key naming conventions:

  • Functions with byte_ in their name operate on raw byte offsets (O(1)).
  • Functions without a prefix count graphemes (human-perceived characters).
  • Use byte_size for performance-critical paths; use grapheme_count when

the result must match what a user sees on screen.