perridak_strings 0.16.1
perridak_strings: ^0.16.1 copied to clipboard
Comprehensive, zero-dependency string utilities for Dart and Flutter. Fast, safe, and rigorously tested.
Perridak Strings #
Comprehensive string utilities for Dart and Flutter. Fast, safe, and rigorously tested with zero external dependencies.
Overview #
Perridak Strings provides a cohesive set of string manipulation functions organised into focused modules. Whether you're building CLI tools, Flutter apps, or server-side Dart projects, this library offers practical utilities for word operations, text normalisation, indentation control, and sentence formatting.
Why use Perridak Strings?
- Minimal dependencies — Pure Dart implementation, runs everywhere
- Full Unicode support — Handles accented characters, emoji, and multi-byte text correctly
- Comprehensive testing — Perridak Software applies a Test-Driven Development methodology
- Pre-release & open to feedback — API stable, but we welcome community input before 1.0.0
Installation #
Add to pubspec.yaml:
dependencies:
perridak_strings: ^0.16.0
Then run:
dart pub get
Quick Start #
import 'package:perridak_strings/perridak_strings.dart';
void main() {
// Word operations
print('hello world'.firstWord()); // 'hello'
print('hello world'.lastWord()); // 'world'
// Text normalisation
print('café'.normaliseAccents()); // 'cafe'
print('Hello World!'.slugify()); // 'hello-world'
// Indentation
print('line1\nline2'.indent(' ')); // ' line1\n line2'
// Sentence formatting
print('hello world'.asSentence()); // 'Hello world.'
}
Modules #
Composition #
String building, decomposition, and transformation.
Building & Concatenation
append(text, [count])— Add text to the end, repeated n timesprefix(text, [count])— Add text to the start, repeated n timesrepeat(count)— Repeat the string n times
Word Operations
firstWord()— Extract the first wordlastWord()— Extract the last wordremoveFirstWord()— Strip the first word and surrounding punctuationremoveLastWord()— Strip the last word and surrounding punctuation
Chunking & Extraction
chunkify(size)— Split into fixed-length chunkstakeFirst(count)— Get the first n characterstakeLast(count)— Get the last n charactersremoveFirst(count)— Remove the first n charactersremoveLast(count)— Remove the last n characters
Text Normalisation
normaliseAccents()— Remove diacritical marks (é → e, ñ → n)normaliseWhitespace()— Collapse multiple spaces, trimremoveAllWhitespace()— Strip all whitespaceremoveSpecialCharacters([removeSpaces])— Keep only alphanumeric and spacesonlyNumbers()— Extract digits onlyonlyLetters()— Extract letters only
String Reversal
reverse()— Simple character reversalsafeReverse()— Reverse while preserving grapheme clusters (emoji-safe)
URL & Display Formatting
slugify()— Convert to URL-safe slug (removes accents, joins with hyphens)truncate(maxLength, [ellipsis])— Limit length, optionally add ellipsismask({revealStart, revealEnd, maskChar})— Hide sensitive data with masking
Indentation #
Layout and spacing control for multi-line strings.
indent(indentation)— Add indentation to all lineshangingIndent(indentation)— Indent all lines except the firstreverseHangingIndent(indentation)— Indent only the first lineremoveIndent(indentation)— Strip indentation from all linesremoveHangingIndent(indentation)— Remove hanging indentationremoveReverseHangingIndent(indentation)— Remove reverse hanging indentation
Segmentation #
Identifier expansion and word extraction.
expandFunctionName()— Split camelCase, snake_case, kebab-case into wordsasWords()— Extract words, remove punctuation, preserve hyphens
Sentences #
Sentence formatting and capitalisation.
asSentence()— Capitalise first letter and ensure sentence ends with terminator
Examples #
Word Extraction #
'This is a sentence.'.firstWord() // 'This'
'This is a sentence.'.lastWord() // 'sentence.'
'Hello World'.removeFirstWord() // 'World'
'Hello World'.removeLastWord() // 'Hello'
Text Normalisation #
'Café au Lait'.normaliseAccents() // 'Cafe au Lait'
' hello world '.normaliseWhitespace() // 'hello world'
'abc123!@#'.removeSpecialCharacters() // 'abc123'
'(123)-456-7890'.onlyNumbers() // '1234567890'
'abc123!'.onlyLetters() // 'abc'
URL Slug Generation #
'Hello World!'.slugify() // 'hello-world'
'Café au Lait'.slugify() // 'cafe-au-lait'
'foo bar baz'.slugify() // 'foo-bar-baz'
Indentation #
'line1\nline2'.indent(' ')
// ' line1\n line2'
'first\nsecond\nthird'.hangingIndent(' ')
// 'first\n second\n third'
Sentence Formatting #
'hello world'.asSentence() // 'Hello world.'
'(hello) world'.asSentence() // 'Hello (world.'
'hello world!'.asSentence() // 'Hello world!'
Identifier Expansion #
'helloWorld'.expandFunctionName() // 'hello World'
'hello_world'.expandFunctionName() // 'hello world'
'HTTPServer'.expandFunctionName() // 'HTTP Server'
Data Masking #
'1234567890'.mask(revealStart: 2, revealEnd: 2) // '12****890'
'password123'.mask(revealStart: 1, revealEnd: 1) // 'p*********3'
Requirements #
- Dart SDK: 3.11.5 or higher
- Flutter: Not required, but works with Flutter 3.13.9+
- Dependencies: One (characters package from Dart team)
Release Status #
Version 0.16.x is a pre-release. The API is stable and thoroughly tested, but we're actively gathering feedback before declaring 1.0.0.
What This Means #
- All functions are production-ready
- Comprehensive tests passing across all modules
- Full Unicode and emoji support
- Comprehensive documentation
- API may evolve based on community feedback
- Additional functions will be added in 0.17.0, 0.18.0, etc.
Roadmap to 1.0.0 #
We're releasing functions in tranches:
- 0.16.0 — Composition, Indentation, Parsing, Sentences (current)
- 0.17.0–0.20.0 — Case conversion, validation, encoding, analysis, formatting
- 1.0.0 — Stable API, locked in
Support & Feedback #
This is a pre-release package. Your feedback shapes the final API.
Report issues or share feedback:
support@perridak.software
General inquiries:
enquiries@perridak.software
Platform Support #
Perridak Strings works on:
- Dart VM (command-line, server)
- Flutter (iOS, Android, macOS, Windows, Linux, Web)
- Web (compiled to JavaScript)
License #
Copyright © 2026 Perridak Software.
Licensed under the MIT License — see the LICENSE file for details.
Contributing #
Perridak Strings is maintained by Perridak Software. The source is currently private while we work out a few of the pre-public quirks, but will be released to github shortly. We welcome feedback and suggestions in the meantime via email at the addresses above.
Made with care by Perridak Software
For more information, visit pub.dev/packages/perridak_strings