//! A set of helper functions for unescaping Fluent unicode escape sequences. //! //! # Unicode //! //! Fluent supports UTF-8 in all FTL resources, but it also allows //! unicode sequences to be escaped in [`String //! Literals`](super::ast::InlineExpression::StringLiteral). //! //! Four byte sequences are encoded with `\u` and six byte //! sqeuences using `\U`. //! ## Example //! //! ``` //! use fluent_syntax::unicode::unescape_unicode_to_string; //! //! assert_eq!( //! unescape_unicode_to_string("Foo \\u5bd2 Bar"), //! "Foo 寒 Bar" //! ); //! //! assert_eq!( //! unescape_unicode_to_string("Foo \\U01F68A Bar"), //! "Foo Bar" //! ); //! ``` //! //! # Other unescapes //! //! This also allows for a char `"` to be present inside an FTL string literal, //! and for `\` itself to be escaped. //! //! ## Example //! //! ``` //! use fluent_syntax::unicode::unescape_unicode_to_string; //! //! assert_eq!( //! unescape_unicode_to_string("Foo \\\" Bar"), //! "Foo \" Bar" //! ); //! assert_eq!( //! unescape_unicode_to_string("Foo \\\\ Bar"), //! "Foo \\ Bar" //! ); //! ``` use std::borrow::Cow; use std::char; use std::fmt;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.