43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
|
#include <array>
|
||
|
|
||
|
#include "hack/logger/logger.hpp"
|
||
|
#include "hack/string/string.hpp"
|
||
|
#include "hack/string/string_concat_helper.hpp"
|
||
|
#include "hack/string/utf8_len.hpp"
|
||
|
|
||
|
auto main(int argc, char *argv[]) -> int
|
||
|
{
|
||
|
{// ex: split string
|
||
|
std::string str { "asdf,qwer,zxcv" };
|
||
|
std::string str_int { "1 2 3" };
|
||
|
hack::string::v_str v = hack::string::split_str(str, ',');
|
||
|
auto v_int = hack::string::split_stoi(str_int, ' ');
|
||
|
hack::log log;
|
||
|
for (const auto& c : v) log(c);
|
||
|
for (const auto& c : v_int) log(c);
|
||
|
|
||
|
std::string str_2 { "qqq,aaa:eee,ggg" };
|
||
|
hack::string::v_str v_2 = hack::string::split_str(str_2, ",:");
|
||
|
for (const auto& c : v_2) log(c);
|
||
|
}
|
||
|
|
||
|
{// ex: string::str_concat
|
||
|
std::string name = "tro";
|
||
|
std::string surname = "lolo";
|
||
|
const auto full_name = hack::string::str_concat + name + ", " + surname;
|
||
|
hack::log()(full_name);
|
||
|
hack::log()(hack::string::str_concat + "super", + "string");
|
||
|
}
|
||
|
|
||
|
{// ex: utf8_size
|
||
|
std::string str = "hi hi";
|
||
|
auto s = hack::string::utf8_len(str);
|
||
|
hack::log()(s);
|
||
|
|
||
|
s = hack::string::utf8_len("asdf");
|
||
|
hack::log()(s);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|