https://github.com/tadd/string_unescape
String#unescape is easy String#undump
https://github.com/tadd/string_unescape
Last synced: 3 months ago
JSON representation
String#unescape is easy String#undump
- Host: GitHub
- URL: https://github.com/tadd/string_unescape
- Owner: tadd
- License: other
- Created: 2018-05-22T12:23:36.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-09-03T13:08:42.000Z (almost 2 years ago)
- Last Synced: 2025-12-05T05:59:56.707Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# String#unescape
String#unescape is condition-relaxed String#undump.
## Usage
```ruby
require 'string_unescape'
puts '\u3059\u3054\u30FC\u3044'.unescape #=> すごーい
puts '\xE3\x81\x9F\xE3\x81\xAE\xE3\x81\x97\xE3\x83\xBC'.unescape #=> たのしー
puts '\u{1F43E}'.unescape #=> 🐾
```
Note that you don't need to wrap the string with `"`.
See [testcase](https://github.com/tadd/string_unescape/blob/master/test/test_string_unescape.rb) also.
## Supported Ruby versions
2.5.x or later.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'string_unescape'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install string_unescape
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tadd/string_unescape .
## License
Ruby's. See [COPYING](COPYING).