From 8b3abd9b86162434c9b27ec03f479d811cd18cec Mon Sep 17 00:00:00 2001 From: msojocs Date: Sun, 6 Aug 2023 20:15:07 +0800 Subject: [PATCH] feat: RemoveQuote --- src/wxss/common.cpp | 20 ++++++++++++++++++-- test/wcsc.disassembly.cpp | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/wxss/common.cpp b/src/wxss/common.cpp index 5bbf816..c4ba1c6 100644 --- a/src/wxss/common.cpp +++ b/src/wxss/common.cpp @@ -3,9 +3,25 @@ namespace WXSS { - std::string RemoveQuote(std::string const&) + std::string RemoveQuote(std::string const& a2) { - throw "not implement"; + std::string a1; + if (a2.length() <= 2) + { + a1 = ""; + } + else + { + if (a2[0] == '\'' || a2[0] == '"') + { + a1 = a2.substr(1, a2.length() - 2); + } + else + { + a1 = a2; + } + } + return a1; } int LintAndParseCSSList(std::map const&, std::string&, std::string&, std::string&, int, bool, bool, bool, std::string const&) { diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index d9aeeed..830fb60 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -7662,7 +7662,7 @@ char *__cdecl WXSS::RemoveQuote(char *a1, char **a2) else { v3 = **a2; - if ( v3 == 39 || v3 == 34 ) + if ( v3 == '\''/*39*/ || v3 == '"'/*34*/ ) std::string::substr(a1, a2, 1u, (unsigned int)(v2 - 2)); else std::string::basic_string(a1, (int)a2);