Data and Math
vtext
Padding, word counts, edit distance and the everyday string checks.
Released v1.0.0 · 2026-09-28use "stdlib/text.ven"
String operations for everyday text: padding, word counts, title case, palindromes, edit distance and longest common subsequence.
print pad_left("7", 4, "0")
print levenshtein_distance("kitten", "sitting")
Reference (13 functions)
API reference
pad_right(s, width, fill)
Pads s on the right with fill until it reaches width.
pad_right("7", 4, "0")pad_center(s, width, fill)
Pads s on both sides with fill until it reaches width.
pad_center("hi", 6, "*")levenshtein_distance(a, b)
Counts the minimum single-character edits needed to turn a into b.
levenshtein_distance("kitten", "sitting")longest_common_subsequence(a, b)
Finds the longest Text that is a subsequence of both a and b.
longest_common_subsequence("ABCBDAB", "BDCABA")words_of(s)
Splits s into whitespace-separated words, collapsing runs of whitespace.
words_of(" a b c ")title_case(s)
Capitalizes the first letter of every word in s, lowercasing the rest.
title_case("the quick brown fox")is_palindrome(s)
Tests whether s reads the same forwards and backwards.
is_palindrome("A man, a plan, a canal: Panama")common_prefix(strings)
Finds the longest Text that is a prefix of every element of strings.
common_prefix(["flower", "flow", "flight"])count_occurrences(s, substring)
Counts the non-overlapping occurrences of substring in s.
count_occurrences("aaaa", "aa")find_all_indices(s, substring)
Finds every starting index where substring occurs in s.
find_all_indices("aaa", "aa")