Skip to main content
i++ provides a string type. The iodine/string.ih library provides string utility functions:

Built in

Use len() to get the length of a string.

From iodine

Use the string library for comparisons, copies, concatenation, and searches.

String length

The built-in len() returns the length of a string:

Available functions

The iodine string library implements these operations. You can expose a symbol for a direct call or keep access namespace-qualified. These operations follow the corresponding C string function conventions. Make sure destination buffers have enough capacity before copying or concatenating.
Functions that write to dest need enough space for the resulting string and its null terminator. The destination capacity is your responsibility.
For example, selectively import strcmp from string.ih and call it through the library namespace:
In this example, neither function is exposed. The @lib qualifier keeps each call explicit. To use unqualified calls instead, add expose strcmp; and expose printd; after the imports.
For example, expose the imported functions:
strcmp returns zero when the strings are equal, a negative value when the first sorts before the second, and a positive value when it sorts after the second. The string library separates its higher-level API from its low-level assembly implementation:
  • string.ih provides functions such as strcmp and strcpy, then delegates the low-level work to its backend.
  • string_x86.ih contains the Linux x86_64 assembly routines used internally by string.ih.
Import string in application code. The backend is an implementation detail, not a replacement for the higher-level library API.