Skip to content

devv-leo/text-modifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Modifier

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.

Features

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")

Usage

  1. Prepare Your Text: Edit sample.txt and insert the text you want to modify, including the appropriate markers.
  2. Run the Tool: Use the command go run . sample.txt result.txt to process the text.
  3. View Results: The modified text will be printed in the terminal and automatically saved to result.txt.

Requirements

  • Go 1.16 or later installed on your system.

Examples

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.

Contributing

Feel free to open issues or submit pull requests for new features or improvements!

About

This is a Go-based tool for modifying text through various transformations, keeping it concise and descriptive for a repository.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages