add more functions

This commit is contained in:
2024-01-06 10:39:12 +08:00
parent 117f6b335c
commit 49070e1e60
2 changed files with 43 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include <list>
#include <stddef.h>
#include <string>
#include <vector>
namespace str_util {
/**
* @brief Convert string to lowercase
@@ -24,9 +25,19 @@ namespace str_util {
* @param input Input string
* @param pattern Partten
* @param max Maximum count of result.
* @param break_quote Break quote.
* @return Result.
*/
std::list<std::string> str_split(std::string input, std::string pattern, size_t max = -1);
std::list<std::string> str_split(std::string input, std::string pattern, size_t max = -1, bool break_quote = true);
/**
* @brief Split string with pattern.
* @param input Input string
* @param pattern Partten
* @param max Maximum count of result.
* @param break_quote Break quote.
* @return Result.
*/
std::vector<std::string> str_splitv(std::string input, std::string pattern, size_t max = -1, bool break_quote = true);
/**
* @brief Convert data to a lowercase hexadecimal string
* @param input Input data
@@ -40,5 +51,11 @@ namespace str_util {
* @return true if input ends with pattern
*/
bool str_endswith(std::string input, std::string pattern);
/**
* @brief Remove quote from a string
* @param input Input string
* @return Result
*/
std::string remove_quote(std::string input);
}
#endif