Crate text_utils

Crate text_utils 

Source
Expand description

§text-utils

Text transformation utilities.

§Binaries

  • rot13: ROT13 cipher (also rotates digits by 5)
  • fix-quotes: Replaces smart quotes with ASCII equivalents
  • hexify: Converts decimal digit sequences to hexadecimal
  • hexwords: Filters stdin for words representable in hex

§Usage

echo "Hello" | rot13
# Output: Uryyb

echo "Hello" | fix-quotes  # fixes curly quotes

hexify "192.168.1.1"
# Output: c0.a8.1.1

cat /usr/share/dict/words | hexwords | head
# Words like: cafe, face, bead, dead...

Functions§

hexify
Converts decimal digit sequences in text to hexadecimal.
replace_quotes
Replaces smart quotes with ASCII equivalents.
rot13_byte
Applies ROT13 to a byte, rotating letters by 13 and digits by 5.
to_hex_char
Converts a character to its hex representation if possible. Returns None for non-hex-representable alphabetic characters.