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-inlen() 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.
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.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.ihprovides functions such asstrcmpandstrcpy, then delegates the low-level work to its backend.string_x86.ihcontains the Linux x86_64 assembly routines used internally bystring.ih.
string in application code. The backend is an implementation detail, not a replacement for the higher-level library API.