File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,28 @@ for (auto match: ctre::range<"([0-9]+),?">(input)) {
254254}
255255```
256256
257+ ### Unicode
258+
259+ ``` c++
260+ #include < ctre-unicode.hpp>
261+ #include < iostream>
262+ // needed if you want to output to the terminal
263+ std::string_view cast_from_unicode (std::u8string_view input) noexcept {
264+ return std::string_view(reinterpret_cast<const char * >(input.data()), input.size());
265+ }
266+ int main()
267+ {
268+ using namespace std::literals;
269+ std::u8string_view original = u8"Tu es un génie"sv;
270+
271+ for (auto match : ctre::range<"\\p{Letter}+">(original))
272+ std::cout << cast_from_unicode(match) << std::endl;
273+ return 0;
274+ }
275+ ```
276+
277+ [link to compiler explorer](https://godbolt.org/z/erTshe6sz)
278+
257279## Running tests (for developers)
258280
259281Just run `make` in root of this project.
You can’t perform that action at this time.
0 commit comments