String Manipulation Toolkit
Case conversion, line operations, and text utilities
Quick Reference: Case Conventions
| Case Style | Languages | Common Usage |
|---|---|---|
camelCase |
JavaScript, TypeScript, Java | Variables, functions, methods |
PascalCase |
C#, TypeScript, Java | Classes, interfaces, types |
snake_case |
Python, Ruby, SQL, C | Variables, database columns |
kebab-case |
HTML, CSS, URLs | CSS classes, URL slugs, CLI flags |
SCREAMING_SNAKE |
Most languages | Constants, env variables |
Tip: Follow your language's conventions (PEP 8 for Python, Airbnb Style Guide for JS). snake_case is generally more readable; camelCase is more compact.
Quick Reference: Line Operations
| Operation | Common Use Cases |
|---|---|
| Trim Lines | Clean copy-pasted data, remove trailing whitespace before commits |
| Pad Lines | Align columns in fixed-width formats, format tables |
| Sort A-Z / Z-A | Organize imports, hosts files, config entries, DNS records |
| Sort Numeric | Order version numbers, IP addresses, port lists, log counts |
| Reverse Lines | Invert chronological logs, reverse stack traces |
| Remove Empty | Clean up multi-line configs, sanitize user lists |
| Shuffle | Randomize test data, generate sample sets |
Tip: Numeric sort extracts the leading number from each line, useful for lines like "192.168.1.1 - server1" or "v2.1.0 - release".
Quick Reference: Duplicate Handling
| Option | Behavior |
|---|---|
| Case sensitive | Apple and apple are treated as different values |
| Trim before compare | Ignores leading/trailing whitespace ( hello = hello) |
| Operation | Use Cases |
|---|---|
| Remove Duplicates | Clean email lists, dedupe hostnames, sanitize IP lists |
| Show Only Duplicates | Find repeated entries in logs, identify conflicts |
| Count Occurrences | Analyze log frequency, find most common errors/IPs |
Tip: Use "Count Occurrences" on server logs to quickly identify the most frequent IP addresses, error codes, or user agents.
Quick Reference: Escape Formats & Security
| Format | Characters Escaped | Use Case |
|---|---|---|
| HTML | & < > " ' |
Display user content, prevent XSS |
| JSON | " \ / + control chars |
API payloads, config files |
| URL | Non-alphanumeric chars | Query params, path segments |
| SQL | ' (doubled to '') |
String literals in queries* |
| Regex | . * + ? ^ $ { } ( ) [ ] \ | |
Literal matching in patterns |
| Shell | Wrapped in single quotes | Safe command arguments |
| CSV | " doubled, field quoted |
Spreadsheet data export |
| XML | & < > " ' |
XML/SOAP payloads |
Security Note (SQL): Escaping single quotes helps but is not sufficient for SQL injection prevention. Always use parameterized queries/prepared statements in production code.
Best Practice: HTML entity encoding prevents basic XSS but is context-dependent. For full protection, encode on output (not input), use Content Security Policy (CSP), and leverage your framework's built-in protections.