6 #include "cont/vector.hpp" 8 #include "core/chrono.h" 16 #define JLE_SS(__EXPR__) ((dynamic_cast<std::ostringstream &>(std::ostringstream().seekp(0, std::ios_base::cur) << __EXPR__ )).str()) 26 std::tuple<double, bool>
27 s_try_s2d (
const std::string& s,
double def_val );
31 s_try_s2i (
const std::string& s,
int def_val );
47 std::tuple<chrono::duration, bool>
48 s_try_s2dur (
const std::string& s,
const chrono::duration& def_val );
56 std::tuple<jle::chrono::time_point, bool>
57 s_try_s2tp (
const std::string& s,
const chrono::time_point& defVal );
64 std::string
s_trim (
const std::string& s ,
char char2remove);
67 std::string
s_trim (
const std::string& s ,
const std::string& chars2remove);
79 const std::string& separator,
80 bool remove_empty =
false 84 std::string s_2lower(
const std::string& s);
85 std::string s_2upper(
const std::string& s);
88 std::string s_align_left (
const std::string& s,
int size,
char char_fill=
' ');
89 std::string s_align_right(
const std::string& s,
int size,
char char_fill=
' ');
94 std::string
align_cols (
const std::string& text);
104 #endif // JLE_STRING_H std::string align_cols(const std::string &text)
format in columns separated by spaces align_cols("aa, b, cccc, dd, eee\n. . . ............ .")
Definition: string.cpp:383
std::tuple< int, bool > s_try_s2i(const std::string &_s, int def_val)
try to convert from string to integer
Definition: string.cpp:260
std::tuple< double, bool > s_try_s2d(const std::string &_s, double def_val)
try to convert from string to double
Definition: string.cpp:242
std::tuple< chrono::time_point, bool > s_try_s2tp(const std::string &s, const chrono::time_point &def_val)
try to convert from string to jle::time_point possible formats...
Definition: string.cpp:150
std::string s_trim(const std::string &s, char char2remove)
remove from left and right char2remove from string s
Definition: string.cpp:17
jle::vector< std::string > s_split(const std::string &s, const std::string &separator, bool remove_empty)
divide string s with separator s_split("a b c") -> ["a", "b", "c"] s_split("a b c") -> ["a"...
Definition: string.cpp:207
std::string s_normalize_utf8(const std::string &source_string)
return a valid utf8 string from a raw one If char is "special" as á, é, í, ó, ú, ñ, ü (and uppercases) it will be converted to utf8. Other weird values will be replaced by "_"
Definition: string.cpp:303
std::tuple< chrono::duration, bool > s_try_s2dur(const std::string &_s, const chrono::duration &def_val)
try to convert from string to jle::duration possible formats...
Definition: string.cpp:65
Definition: vector.hpp:17
generic namespace
Definition: alarm.cpp:12