martinzink commented on code in PR #1753:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1753#discussion_r1561039947
##########
libminifi/src/utils/StringUtils.cpp:
##########
@@ -538,6 +538,56 @@ nonstd::expected<std::optional<char>, ParseError>
parseCharacter(std::string_vie
return nonstd::make_unexpected(ParseError{});
}
+std::string replaceEscapedCharacters(std::string_view input) {
+ std::stringstream result;
+ for (size_t i = 0; i < input.size(); ++i) {
+ char input_char = input[i];
+ if (input_char != '\\' || i == input.size() - 1) {
+ result << input_char;
+ continue;
+ }
+ char next_char = input[i+1];
+ switch (next_char) {
+ case '0':
+ result << '\0'; // Null
+ ++i;
+ break;
+ case 'a':
+ result << '\a'; // Bell
+ ++i;
+ break;
+ case 'b':
+ result << '\b'; // Backspace
+ ++i;
+ break;
+ case 't':
+ result << '\t'; // Horizontal Tab
+ ++i;
+ break;
+ case 'n':
+ result << '\n'; // Line Feed
+ ++i;
+ break;
+ case 'v':
+ result << '\v'; // Vertical Tab
+ ++i;
+ break;
+ case 'f':
+ result << '\f'; // Form Feed
+ ++i;
+ break;
+ case 'r':
+ result << '\r'; // Carriage Return
+ ++i;
+ break;
+ default:
+ result << '\\';
Review Comment:
I think it should be "\s", that means the parseCharacter should throw error
i guess?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]