FastLED 3.9.15
Loading...
Searching...
No Matches

◆ unescape_string()

fl::string fl::anonymous_namespace{json.cpp.hpp}::unescape_string ( const fl::span< const char > & span)

Definition at line 631 of file json.cpp.hpp.

631 {
633 result.reserve(span.size());
634
635 for (size_t i = 0; i < span.size(); i++) {
636 if (span[i] == '\\' && i + 1 < span.size()) {
637 char next = span[i + 1];
638 switch (next) {
639 case '"': result += '"'; i++; break;
640 case '\\': result += '\\'; i++; break;
641 case '/': result += '/'; i++; break;
642 case 'b': result += '\b'; i++; break;
643 case 'f': result += '\f'; i++; break;
644 case 'n': result += '\n'; i++; break;
645 case 'r': result += '\r'; i++; break;
646 case 't': result += '\t'; i++; break;
647 default: result += span[i]; break; // Pass through unknown escapes
648 }
649 } else {
650 result += span[i];
651 }
652 }
653
654 return result;
655}
constexpr fl::size size() const FL_NOEXCEPT
Definition span.h:458
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References fl::span< T, Extent >::size(), and unescape_string().

Referenced by fl::anonymous_namespace{json.cpp.hpp}::JsonBuilder::on_token(), and unescape_string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: