#escaping #string-literal #string #character

unescaper

Unescape strings with escape sequences written out as literal characters

6 releases

0.1.5 Jun 26, 2024
0.1.4 Jan 23, 2024
0.1.3 Nov 24, 2023
0.1.2 Aug 20, 2023
0.1.1 Aug 9, 2022

#61 in Text processing

Download history 38388/week @ 2024-08-13 35745/week @ 2024-08-20 31039/week @ 2024-08-27 35637/week @ 2024-09-03 32652/week @ 2024-09-10 35662/week @ 2024-09-17 37821/week @ 2024-09-24 33635/week @ 2024-10-01 44552/week @ 2024-10-08 41470/week @ 2024-10-15 42251/week @ 2024-10-22 36546/week @ 2024-10-29 34090/week @ 2024-11-05 36624/week @ 2024-11-12 37334/week @ 2024-11-19 30422/week @ 2024-11-26

144,593 downloads per month
Used in 375 crates (16 directly)

GPL-3.0/MIT

18KB
192 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

~265–730KB
~17K SLoC