Crate text_utils

Source
Expand description

§Text utility function library

§Interface

This library is biased towards input strings and returns new strings This library uses polymorphic interface

  • if accept String, use (impl Into<String>)
  • if accept &str, use (impl AsRef<str>)

Re-exports§

pub use crate::Result;

Macros§

slugify

Structs§

Color
Color in rgba format, where {red,green,blue} in 0..255, alpha in 0.0..1.0
Emoji
A specific emoji.
NAMED_COLORS
List of CSS3 named colors from http://www.w3.org/TR/css3-color.

Enums§

TextError
Error of text progress

Functions§

capitalize_first_letter
capitalize first letter
dedent
Removes common leading whitespace from each line.
dedent_less_than
Removes at most n leading whitespace from each line
indent
Adds spaces to each non-empty line.
indent_count
Calculate how much space the first line has
indent_with
Adds prefix to each non-empty line.
parse_color
Named: eg. slateblue#fff#ff0011rgba(255, 128, 12, 0.5)
parse_emoji
Parses the given Emoji name into a unicode Emoji.
slugify
unescape
Takes in a string with backslash escapes written out with literal backslash characters and converts it to a string with the proper escaped characters.
unescape_dec_chars
unescape \u{xx xx xx}
unescape_hex_chars
unescape \U{xx xx xx}
unescape_only
unescape_only
unescape_unchecked
unchecked version of unescape
unescape_utf8
unescape_utf8
url_decode
url_decode
url_encode
url_encode

Type Aliases§

Result
Result of text progress