textx
A small and simple string utilities library written in Gleam.
Features
- Reverse strings
- Check palindromes
- Capitalize first letter
- Count words in a string
Installation
gleam add textx
Example
import textx
pub fn main() {
textx.reverse("gleam")
textx.is_palindrome("madam")
textx.capitalize("hello")
textx.word_count("hello world")
}
API
reverse(text: String) -> String
Reverses a string using grapheme-safe operations.
is_palindrome(text: String) -> Bool
Returns True if the string reads the same forwards and backwards.
capitalize(text: String) -> String
Capitalizes the first letter of a string.
word_count(text: String) -> Int
Counts words separated by spaces.
Repository
https://github.com/dj-kaif/textx
Notes
This library is designed for learning Gleam package structure, including:
- modules
- tests
- publishing to Hex
- functional string processing