Skip to main content

Module stdlib

Module stdlib 

Source
Expand description

Standard library functions for Sage.

This module provides runtime helper functions for the Sage standard library. Most stdlib functions are inlined during codegen, but some require runtime helpers for correct Unicode handling or complex logic.

Functions§

parse_bool
Parse a boolean from a string. Accepts “true”, “false”, “1”, “0” (case-insensitive for true/false).
str_index_of
Find the index of a substring within a string (Unicode-aware). Returns None if not found, Some(index) otherwise.
str_pad_end
Pad a string at the end to reach the target length (Unicode-aware).
str_pad_start
Pad a string at the start to reach the target length (Unicode-aware).
str_slice
Extract a substring by character indices (Unicode-aware). Indices are inclusive start, exclusive end.