18#ifndef __FPSDK_COMMON_STRING_HPP__ 
   19#define __FPSDK_COMMON_STRING_HPP__ 
   47#  define PRINTF_ATTR(n) __attribute__((format(printf, n, n + 1))) 
   68std::
string Vsprintf(const 
char* fmt, va_list args);
 
   79std::
string Strftime(const 
char* const fmt, const int64_t ts = 0, const 
bool utc = false);
 
   91int StrReplace(std::
string& str, const std::
string& search, const std::
string& replace, const 
int max = 0);
 
  131std::vector<std::
string> 
StrSplit(const std::
string& str, const std::
string& sep, const 
int maxNum = 0);
 
  141std::
string StrJoin(const std::vector<std::
string>& strs, const std::
string& sep);
 
  152    const std::vector<std::
string>& strs, std::function<std::
string(const std::
string&)> map);
 
  168std::vector<std::
string> 
HexDump(const std::vector<uint8_t> data);
 
  178std::vector<std::
string> 
HexDump(const uint8_t* data, const std::
size_t size);
 
  188std::
string StrFormatBits(const uint64_t value, const std::
size_t size = 64);
 
  208bool StrEndsWith(const std::
string& str, const std::
string& suffix);
 
  404constexpr const 
char* 
ToStr(const 
bool value)
 
  406    return value ? 
"true" : 
"false";
 
  416std::vector<uint8_t> 
StrToBuf(
const std::string& str);
 
  425std::string 
BufToStr(
const std::vector<uint8_t>& buf);
 
std::string Vsprintf(const char *fmt, va_list args)
Format string.
 
std::string Strftime(const char *const fmt, const int64_t ts=0, const bool utc=false)
Format time.
 
void StrTrimLeft(std::string &str)
Trim string left.
 
std::vector< std::string > StrSplit(const std::string &str, const std::string &sep, const int maxNum=0)
Split string.
 
std::string StrToUpper(const std::string &str)
Convert string to all upper case.
 
std::vector< std::string > HexDump(const std::vector< uint8_t > data)
Format hexdump of data.
 
std::vector< uint8_t > StrToBuf(const std::string &str)
Convert string to buffer.
 
void StrTrimRight(std::string &str)
Trim string right.
 
std::vector< std::string > StrMap(const std::vector< std::string > &strs, std::function< std::string(const std::string &)> map)
Map strings.
 
void StrTrim(std::string &str)
Trim string left and right.
 
constexpr const char * ToStr(const bool value)
Stringify value (bool)
 
std::string StrToLower(const std::string &str)
Convert string to all lower case.
 
std::vector< uint8_t > Base64Dec(const std::string &str)
Decode from base64.
 
bool StrToValue(const std::string &str, int8_t &value)
Convert string to value (int8_t)
 
bool StrEndsWith(const std::string &str, const std::string &suffix)
Check if one string ends with another string.
 
std::string StrFormatBits(const uint64_t value, const std::size_t size=64)
Format value to "bits string".
 
bool StrContains(const std::string &str, const std::string &sub)
Check if one string is contained within another string string.
 
std::string Sprintf(const char *const fmt,...) PRINTF_ATTR(1)
Format string.
 
bool StrStartsWith(const std::string &str, const std::string &prefix)
Check if one string starts with another string.
 
std::string StrJoin(const std::vector< std::string > &strs, const std::string &sep)
Join strings.
 
std::string StrError(const int errnum)
Stringify glibc error.
 
int StrReplace(std::string &str, const std::string &search, const std::string &replace, const int max=0)
Search and replace.
 
std::string BufToStr(const std::vector< uint8_t > &buf)
Convert buffer to string.
 
void MakeUnique(std::vector< std::string > &strs)
Remove duplicates.
 
std::string Base64Enc(const std::vector< uint8_t > &buf)
Encode to base64.
 
Fixposition SDK: Common library.
 
#define PRINTF_ATTR(n)
Helper macro for marking functions as taking printf() style formatting strings.