ifw-core  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
ctd::string Namespace Reference

Functions

std::string Upper (const std::string &str)
 Uppercase string. More...
 
std::string Lower (const std::string &str)
 Lower case string. More...
 
std::string Trim (const std::string &str, const std::string &trim_chars)
 Trim input string for leading/trailing characters. More...
 
std::string Replace (const std::string &str, const std::string &old_sub_str, const std::string &new_sub_str)
 Replace occurences of "old_sub_str" with "new_sub_str" in "str". More...
 
std::string Truncate (const std::string &text, const int32_t max_len, const std::string &truncation_indicator="...")
 Truncate "str" if longer than "max_len". More...
 
void Split (const std::string &str, const std::string &separator, std::vector< std::string > &str_els)
 Split "str" according to the sequence of separator characters given. More...
 
void SplitBuffer (const std::string buffer, std::vector< std::string > &buffer_lines, const bool strip=true, const bool remove_empty_lines=true, const std::string remove_comments="")
 Split a buffer, typically a file buffer, with newline characters. More...
 
template<class TYPE >
std::string Concat (const std::vector< TYPE > &list, const std::string &sep="")
 Concatenate elements of the given type, contained in the list. More...
 
void StringCopy (char *dest_buf, const char *src_buf, const int32_t max_bytes, const bool truncate=false)
 Safe string copy. If the length of “src_buf” exceeds “max_bytes” the string may either be truncated or the function fails. More...
 
bool Match (const std::string &str, const std::string &reg_exp)
 Carry out a regular expression match on the given string. More...
 

Function Documentation

template<class TYPE >
std::string ctd::string::Concat ( const std::vector< TYPE > &  list,
const std::string &  sep = "" 
)

Concatenate elements of the given type, contained in the list.

std::string ctd::string::Lower ( const std::string &  str)

Lower case string.

bool ctd::string::Match ( const std::string &  str,
const std::string &  reg_exp 
)

Carry out a regular expression match on the given string.

Todo:
Use mutex to protect this.
Todo:
Use mutex to protect this.
std::string ctd::string::Replace ( const std::string &  str,
const std::string &  old_sub_str,
const std::string &  new_sub_str 
)

Replace occurences of "old_sub_str" with "new_sub_str" in "str".

void ctd::string::Split ( const std::string &  str,
const std::string &  separator,
std::vector< std::string > &  str_els 
)

Split "str" according to the sequence of separator characters given.

void ctd::string::SplitBuffer ( const std::string  buffer,
std::vector< std::string > &  buffer_lines,
const bool  strip = true,
const bool  remove_empty_lines = true,
const std::string  remove_comments = "" 
)

Split a buffer, typically a file buffer, with newline characters.

void ctd::string::StringCopy ( char *  dest_buf,
const char *  src_buf,
const int32_t  max_bytes,
const bool  truncate = false 
)

Safe string copy. If the length of “src_buf” exceeds “max_bytes” the string may either be truncated or the function fails.

std::string ctd::string::Trim ( const std::string &  str,
const std::string &  trim_chars 
)

Trim input string for leading/trailing characters.

std::string ctd::string::Truncate ( const std::string &  text,
const int32_t  max_len,
const std::string &  truncation_indicator = "..." 
)

Truncate "str" if longer than "max_len".

std::string ctd::string::Upper ( const std::string &  str)

Uppercase string.