idealvin / gitalk

comments for Alvin's blog
0 stars 0 forks source link

String Utility | Documents for Coost #117

Open idealvin opened 1 year ago

idealvin commented 1 year ago

https://coostdocs.github.io/en/co/other/str/

include: co/str.h.

String operations #str::cat template <typename ...X> inline fastring cat(X&& ... x); Added in v2.0.3. Concatenate any number of elements to make a string.

示例 str::cat("hello", ' ', 23); // -> "hello 23" str::cat("xx", 3.14, "true"); // -> "xx3.14true" #str::replace fastring replace(const char s, size_t n, const char sub, size_t m, const char to, size_t l, size_t t=0); fastring replace(const char s, size_t n, const char sub, const char to, size_t t=0); fastring replace(const char s, const char sub, const char to, size_t t=0); fastring replace(const fastring& s, const char sub, const char to, size_t t=0); fastring replace(const std::string& s, const char sub, const char* to, size_t t=0); Replace substring sub in string s with to, n is the length of s, m is the length of sub, and l is the length of to; t is the maximum number of replacements, the default is 0 for unlimited.