common_util
Loading...
Searching...
No Matches
strutil.h
Go to the documentation of this file.
1
19#pragma once
20
21#include <string>
22#include <vector>
23
24namespace cutl
25{
30 using strvec = std::vector<std::string>;
31
38 std::string to_upper(const std::string &str);
45 std::string to_lower(const std::string &str);
46
53 std::string lstrip(const std::string &str);
60 std::string rstrip(const std::string &str);
67 std::string strip(const std::string &str);
68
77 bool starts_with(const std::string &str, const std::string &start, bool ignoreCase = false);
86 bool ends_with(const std::string &str, const std::string &end, bool ignoreCase = false);
87
95 strvec split(const std::string &str, const std::string &separator);
103 std::string join(const strvec &strlist, const std::string &separator = "");
104
111 std::string desensitizing(const std::string &str);
112
113} // namespace cutl
std::vector< std::string > strvec
The type of vector strings used in this library.
Definition strutil.h:30
std::string rstrip(const std::string &str)
Remove trailing whitespaces from a string.
bool ends_with(const std::string &str, const std::string &end, bool ignoreCase=false)
Check if a string ends with a given substring.
std::string to_lower(const std::string &str)
Convert a string to lower case.
strvec split(const std::string &str, const std::string &separator)
Split a string into a vector of substrings using a given separator.
std::string to_upper(const std::string &str)
Convert a string to upper case.
std::string join(const strvec &strlist, const std::string &separator="")
Join a vector of strings into a single string using a given separator.
bool starts_with(const std::string &str, const std::string &start, bool ignoreCase=false)
Check if a string starts with a given substring.
std::string lstrip(const std::string &str)
Remove leading whitespaces from a string.
std::string strip(const std::string &str)
Remove leading and trailing whitespaces from a string.
std::string desensitizing(const std::string &str)
Desensitizing a string by replacing some characters with '*'.