feat: finish string helper except Split()
- add string lower upper function in string helper. - add join function in string helper. - add split function in string helper but implementation is not perfect and should be imporved in future.
This commit is contained in:
@ -15,6 +15,18 @@ namespace Testbench {
|
||||
YYCC::StringHelper::Printf(u8"Translation: %s == %s\n", u8"Hello World", u8"你好世界").c_str(),
|
||||
stdout
|
||||
);
|
||||
|
||||
std::string test_string(u8"UPPER -> lower\n");
|
||||
YYCC::TerminalHelper::FPuts(test_string.c_str(), stdout);
|
||||
YYCC::TerminalHelper::FPuts(YYCC::StringHelper::Lower(test_string.c_str()).c_str(), stdout);
|
||||
YYCC::TerminalHelper::FPuts(YYCC::StringHelper::Upper(test_string.c_str()).c_str(), stdout);
|
||||
|
||||
std::vector<std::string> test_container {
|
||||
"test1", "test2", "test3", "test4"
|
||||
};
|
||||
YYCC::TerminalHelper::FPuts(YYCC::StringHelper::Join(test_container, ", ").c_str(), stdout);
|
||||
std::string test_split(", 1, 3, 5, 7, 9, ");
|
||||
YYCC::TerminalHelper::FPuts(YYCC::StringHelper::Join(YYCC::StringHelper::Split(test_split.c_str(), ", "), " -> ").c_str(), stdout);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user