π String Pipeline
A powerful string transformation CLI tool and Rust library that makes complex text processing simple. Transform data using intuitive template syntax β chain operations like split, join, replace, filter, and 20+ others in a single readable expression.
π Table of Contents
- π Why String Pipeline?
- β‘ Quick Examples
- π Installation
- π Quick Start
- π Documentation
- π§ͺ Testing
- π€ Contributing
- π License
π Why String Pipeline?
Transform complex text processing into simple, readable templates:
# Traditional approach (multiple commands)
| \
| \
| \
| \
| \
# String Pipeline (single template)
# Output: "company.org,email.com"
β¨ Key Features
- π Chainable Operations: Pipe operations together naturally
- π― Precise Control: Python-like ranges with Rust syntax (
-2..
,1..=3
) - πΊοΈ Powerful Mapping: Apply sub-pipelines to each list item
- π Regex Support: sed-like patterns for complex transformations
- π Debug Mode: Step-by-step operation visualization
- β‘ Performance Tools: Comprehensive benchmarking and optimization
- π₯ Flexible I/O: CLI tool + embeddable Rust library
β‘ Quick Examples
π₯ Basic Transformations
# Extract middle items from list
# Output: "b,c"
# Clean and format names
# Output: "JOHN!,JANE!,BOB!"
# Extract numbers and pad with zeros
# Output: "001,022,333"
π§ Advanced Processing
# Filter files, format as list
# Output: "β’ app.py\nβ’ test.py"
# Extract domains from URLs
# Output: "GITHUB.COM,GOOGLE.COM"
# Debug complex processing
# Output: Date,Banana
π‘ Want to see more? Check out the π Documentation with 20+ operations and real-world examples!
π Installation
π¦ CLI Tool
# Install from crates.io
# Or build from source
π Rust Library
Add to your Cargo.toml
:
[]
= "0.12.0"
π Quick Start
π» CLI Usage
# With argument
# With stdin
|
# Debug mode (shows each step)
# DEBUG: π MULTI-TEMPLATE
# DEBUG: βββ π MULTI-TEMPLATE START
# DEBUG: βββ Template: "{!split:,:..|map:{upper}}"
# DEBUG: βββ β‘οΈ Input: "hello,world"
# DEBUG: βββ 1 sections to process (literal: 0, template: 1)
# DEBUG: β
# DEBUG: βββ π SECTION 1/1: [template: split(',',..) | map { operations: [upper] }]
# DEBUG: βββ πΎ CACHE MISS Computing and storing result
# DEBUG: β
# DEBUG: βββ π Main Pipeline
# DEBUG: β βββ π PIPELINE START: 2 operations
# DEBUG: β βββ β‘οΈ Input: String(hello,world)
# DEBUG: β βββ 1. Split(',')
# DEBUG: β βββ 2. Map(1)
# DEBUG: β βββ βοΈ Step 1: Split
# DEBUG: β β βββ β‘οΈ Input: String(hello,world)
# DEBUG: β β βββ π― Result: List["hello", "world"]
# DEBUG: β β βββ Time: 332.41Β΅s
# DEBUG: β βββ βοΈ Step 2: Map
# DEBUG: β β βββ β‘οΈ Input: List["hello", "world"]
# DEBUG: β β βββ π― Result: String(processing...)
# DEBUG: β β βββ Time: 0ns
# DEBUG: β β βββ ποΈ Item 1/2
# DEBUG: β β β βββ β‘οΈ Input: "hello"
# DEBUG: β β β βββ π Sub-Pipeline
# DEBUG: β β β β βββ π§ SUB-PIPELINE START: 1 operations
# DEBUG: β β β β βββ β‘οΈ Input: String(hello)
# DEBUG: β β β β βββ βοΈ Step 1: Upper
# DEBUG: β β β β β βββ β‘οΈ Input: String(hello)
# DEBUG: β β β β β βββ π― Result: String(HELLO)
# DEBUG: β β β β β βββ Time: 875ns
# DEBUG: β β β β βββ β
SUB-PIPELINE COMPLETE
# DEBUG: β β β β βββ π― Result: String(HELLO)
# DEBUG: β β β β βββ Time: 16.37Β΅s
# DEBUG: β β β βββ Output: "HELLO"
# DEBUG: β β βββ ποΈ Item 2/2
# DEBUG: β β β βββ β‘οΈ Input: "world"
# DEBUG: β β β βββ π Sub-Pipeline
# DEBUG: β β β β βββ π§ SUB-PIPELINE START: 1 operations
# DEBUG: β β β β βββ β‘οΈ Input: String(world)
# DEBUG: β β β β βββ βοΈ Step 1: Upper
# DEBUG: β β β β β βββ β‘οΈ Input: String(world)
# DEBUG: β β β β β βββ π― Result: String(WORLD)
# DEBUG: β β β β β βββ Time: 93ns
# DEBUG: β β β β βββ β
SUB-PIPELINE COMPLETE
# DEBUG: β β β β βββ π― Result: String(WORLD)
# DEBUG: β β β β βββ Time: 15.749Β΅s
# DEBUG: β β β βββ Output: "WORLD"
# DEBUG: β β βββ π¦ MAP COMPLETED: 2 β 2 items
# DEBUG: β βββ β
PIPELINE COMPLETE
# DEBUG: β βββ π― Result: List["HELLO", "WORLD"]
# DEBUG: β βββ Time: 457.193Β΅s
# DEBUG: β
# DEBUG: βββ π β
MULTI-TEMPLATE COMPLETE
# DEBUG: βββ π― Final result: "HELLO,WORLD"
# DEBUG: βββ Total execution time: 568.533Β΅s
# DEBUG: βββ Cache stats: 0 regex patterns, 1 split operations cached
# HELLO,WORLD
π¦ Library Usage
use Template;
π Documentation
π― π Template System
π βοΈ CLI Options & Usage
π π Comprehensive Debug System Guide
β‘ π Performance Benchmarking Guide
Everything you need to master String Pipeline:
- ποΈ Template Syntax - Structure, chaining, escaping rules
- π Operations Reference - 20+ operations with examples
- πͺ Split & Join - Parse and reassemble text
- βοΈ Slice & Range - Extract with Python-like indices
- π¨ Transform - Case, trim, pad, append/prepend
- π Regex - Pattern matching and replacement
- ποΈ List Ops - Filter, sort, unique, reverse
- πΊοΈ Map - Apply operations to each item
- π― Range Specifications - Negative indexing, edge cases
- π‘οΈ Escaping Rules - When and how to escape characters
- π Debug Mode - Visual operation debugging
- π‘ Real-world Examples - Data processing, log analysis, formatting
- β οΈ Troubleshooting - Common errors and best practices
π§ͺ Testing
# Run all tests
# Run with output
# Run benchmarks
β‘ Performance & Benchmarking
String Pipeline includes simple benchmarking tools for measuring performance:
# Build the benchmark tool
# Run benchmarks (1000 iterations)
# Quick performance check (100 iterations)
# Generate JSON for scripts
Performance Examples:
- Fast basic operations: 100-150ns (upper, lower, trim)
- List processing: 3-6ΞΌs (split, join, sort)
- Complex transformations: 10-60ΞΌs (map operations, regex)
- Release builds: 3-10x faster than debug builds
See the π Performance Benchmarking Guide for timing details and measurement tips.
π€ Contributing
We welcome contributions! π
- π Report bugs via GitHub Issues
- π‘ Suggest features or improvements
- π§ Submit pull requests
π Please see our comprehensive documentation for syntax details and examples.
π License
This project is licensed under the MIT License. See LICENSE for details.
β‘ Fast, composable string transformations made simple!