Data and Math

vtext

Padding, word counts, edit distance and the everyday string checks.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/text.ven"

String operations for everyday text: padding, word counts, title case, palindromes, edit distance and longest common subsequence.

vtext.ven
print pad_left("7", 4, "0")
print levenshtein_distance("kitten", "sitting")
Reference (13 functions)

API reference

pad_left(s, width, fill)

Pads s on the left with fill until it reaches width.

pad_left("7", 4, "0")

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 ")

word_count(s)

Counts the whitespace-separated words in s.

word_count("the quick brown fox")

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"])

slugify(s)

Turns s into a lowercase, hyphen-separated slug.

slugify("Hello, World! 123")

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")

Get notified when vtext changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.