mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-06-06 05:08:45 +08:00
add more functions
This commit is contained in:
19
str_util.h
19
str_util.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user