#escaping #string

unescaper

Unescape strings with escape sequences written out as literal characters

5 releases

0.1.4 Jan 23, 2024
0.1.3 Nov 24, 2023
0.1.2 Aug 20, 2023
0.1.1 Aug 9, 2022
0.1.0 Aug 9, 2022

#79 in Text processing

Download history 9407/week @ 2023-12-23 13495/week @ 2023-12-30 15649/week @ 2024-01-06 17286/week @ 2024-01-13 18832/week @ 2024-01-20 20775/week @ 2024-01-27 23938/week @ 2024-02-03 23631/week @ 2024-02-10 19357/week @ 2024-02-17 21057/week @ 2024-02-24 22626/week @ 2024-03-02 23184/week @ 2024-03-09 23722/week @ 2024-03-16 24522/week @ 2024-03-23 24891/week @ 2024-03-30 24296/week @ 2024-04-06

100,251 downloads per month
Used in 279 crates (7 directly)

GPL-3.0/MIT

18KB
191 lines

Unescaper

Unescape strings with escape sequences written out as literal characters.

License GPLv3 License MIT Checks GitHub tag (latest by date) GitHub code lines GitHub last commit

Usage

More Examples

fn main() {
	assert_eq!(unescaper::unescape(r"\u000a").unwrap(), "\n");
	assert_eq!(unescaper::unescape(r"\u{a}").unwrap(), "\n");
	assert_eq!(unescaper::unescape(r"\x0a").unwrap(), "\n");
	assert_eq!(unescaper::unescape(r"\12").unwrap(), "\n");
}

Thanks

The idea comes from unescape-rs.
The last commit of that repository was seven years ago.
So, I think it is no longer maintained.
That's why I created this repository, and I have made some improvements.

Dependencies

~330–790KB
~19K SLoC