szaszm commented on a change in pull request #1073:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1073#discussion_r645517495



##########
File path: libminifi/include/utils/StringUtils.h
##########
@@ -137,6 +137,7 @@ class StringUtils {
 
   static std::vector<std::string> split(const std::string &str, const 
std::string &delimiter);
   static std::vector<std::string> splitAndTrim(const std::string &str, const 
std::string &delimiter);
+  static std::vector<std::string> splitAndTrimOnString(std::string str, const 
std::string& delimiter);

Review comment:
       3 reasonable ways of using the delimiter string if it's longer than a 
character is
   1. Match any of the characters in the string. Strings like this would be 
reasonable: `" \t;:,"`. C# does this.
   2. Match the whole delimiter string as a delimiter. This is the case with 
...OnString now. JavaScript and Python does this.
   3. Match the whole delimiter string as a regex. Java does this, but I 
wouln't go this route.
   
   Taking a string and only using its first character is a bit strange to me, I 
would change that behavior. The fact that it's trimmed after splitting should 
be relatively separate, but convenience functions are OK.
   
   I can't think of a good and simple solution that does it all and that I 
wouldn't want to change eventually, so I'm not making any suggestions, but I'm 
happy to provide my opinion if you want to change it. Please consider adding 
comments that clarify the behavior.




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to