A simple command-line tool built in Go that transforms text by applying various modifications based on special markers. Perfect for quick text processing tasks like formatting, case changes, and punctuation fixes.
This tool supports the following text modifications using embedded markers:
- Hexadecimal Conversion: Replace
(hex)with the decimal equivalent of the preceding hexadecimal number. (e.g., "1E (hex)" → "30") - Binary Conversion: Replace
(bin)with the decimal equivalent of the preceding binary number. (e.g., "10 (bin)" → "2") - Case Changes:
(up): Uppercase the previous word. (e.g., "go (up)" → "GO")(low): Lowercase the previous word. (e.g., "SHOUTING (low)" → "shouting")(cap): Capitalize the previous word. (e.g., "bridge (cap)" → "Bridge")- Add a number for multiple words:
(up, 2)uppercases the last 2 words.
- Punctuation Formatting: Ensures punctuation marks (
.,,,!,?,:,;) are attached to the previous word with a space after, except for groups like...or!?which stay together. - Quote Handling: Removes spaces around single quotes
', placing them directly next to the enclosed words. - Article Correction: Changes "a" to "an" before words starting with vowels (a, e, i, o, u) or "h". (e.g., "a amazing" → "an amazing")
- Prepare Your Text: Edit
sample.txtand insert the text you want to modify, including the appropriate markers. - Run the Tool: Use the command
go run . sample.txt result.txtto process the text. - View Results: The modified text will be printed in the terminal and automatically saved to
result.txt.
- Go 1.16 or later installed on your system.
Basic Case Change:
Input in sample.txt: it (cap) was the best of times
Output: It was the best of times
Multiple Transformations:
Input: Simply add 42 (hex) and 10 (bin) and you will see the result is 68.
Output: Simply add 66 and 2 and you will see the result is 68.
Punctuation and Quotes:
Input: Punctuation tests are ... kinda boring ,what do you think ?
Output: Punctuation tests are... kinda boring, what do you think?
Article Fix:
Input: There is no greater agony than bearing a untold story inside you.
Output: There is no greater agony than bearing an untold story inside you.
Feel free to open issues or submit pull requests for new features or improvements!