Expand description
String utility functions for Unicode-safe text manipulation.
Functions§
- estimate_
tokens - Rough token count estimate: 1 token ≈ 4 Unicode scalar values.
- format_
tokens - Format a token count as a short human-readable string.
- patch_
frontmatter_ fields - Insert or overwrite fields in a
SKILL.mdfrontmatter block. - truncate_
chars - Borrow a prefix of
sthat is at mostmax_charsUnicode scalar values long. - truncate_
to_ bytes - Truncate
sto at mostmax_bytesbytes, preserving UTF-8 char boundaries. - truncate_
to_ bytes_ ref - Borrow a prefix of
sthat fits withinmax_bytesbytes. - truncate_
to_ chars - Truncate a string to at most
max_charsUnicode scalar values. - xml_
escape - Escape XML special characters in a string.