commonlib
StringHelper Class Reference

The class StringHelper implements functions for handling strings. More...

#include <stringhelper.h>

Static Public Member Functions

static std::string format (const char *fmt,...)
 Function works like printf function in CXX. More...
 
static std::string toUppercase (const std::string &input)
 Function converts lowercase letter to uppercase. More...
 
static std::string toLowercase (const std::string &input)
 Function converts uppercase letter to lowercase. More...
 
static bool areSame (const std::string &lhs, const std::string &rhs)
 Function compares two strings by ordinal value without case sensitivity. More...
 
static void replaceAll (std::string &input, const std::string &oldStr, const std::string &newStr)
 Function replaces all occurrences of a substring oldStr in str with newStr. More...
 
static std::vector< std::string > tokenize (const std::string &input, char delimiter)
 Function returns the list strings separated by the delimiter value. More...
 
static std::string lTrim (const std::string &input)
 Function removes blank and control characters (such as line feed) from the start of a string. More...
 
static std::string rTrim (const std::string &input)
 Function removes blank and control characters (such as line feed) from the end of a string. More...
 
static std::string trim (const std::string &input)
 Function removes blank and control characters (such as line feed) from the start and end of a string. More...
 
static std::string serialNumberToStr (uint64_t serialNumber)
 Function converts serial number to display string. More...
 
static std::wstring localEncodingToWide (const std::string &localStr)
 
localEncodingStrToUtf16Str Function converts local windows encoding string to utf16 string More...
 

Detailed Description

The class StringHelper implements functions for handling strings.

Member Function Documentation

◆ areSame()

static bool StringHelper::areSame ( const std::string &  lhs,
const std::string &  rhs 
)
static

Function compares two strings by ordinal value without case sensitivity.

Parameters
lhsstring
rhsstring
Returns
true if strings are equal

◆ format()

static std::string StringHelper::format ( const char *  fmt,
  ... 
)
static

Function works like printf function in CXX.

Parameters
fmtsee printf documentation
...arbitrary number of parameters
Returns
formatted string

◆ localEncodingToWide()

static std::wstring StringHelper::localEncodingToWide ( const std::string &  localStr)
static


localEncodingStrToUtf16Str Function converts local windows encoding string to utf16 string

Parameters
localStrstring in local encoding
Returns
string in utf16 encoding

◆ lTrim()

static std::string StringHelper::lTrim ( const std::string &  input)
static

Function removes blank and control characters (such as line feed) from the start of a string.

Parameters
inputstring
Returns
changed string

◆ replaceAll()

static void StringHelper::replaceAll ( std::string &  input,
const std::string &  oldStr,
const std::string &  newStr 
)
static

Function replaces all occurrences of a substring oldStr in str with newStr.

Parameters
inputstring
oldStrstring pattern
newStrstring pattern
Returns
changed string

◆ rTrim()

static std::string StringHelper::rTrim ( const std::string &  input)
static

Function removes blank and control characters (such as line feed) from the end of a string.

Parameters
inputstring
Returns
changed string

◆ serialNumberToStr()

static std::string StringHelper::serialNumberToStr ( uint64_t  serialNumber)
static

Function converts serial number to display string.

Parameters
serialnumber
Returns
serial number string

◆ tokenize()

static std::vector<std::string> StringHelper::tokenize ( const std::string &  input,
char  delimiter 
)
static

Function returns the list strings separated by the delimiter value.

Parameters
inputstring
delimitervalue
Returns
list of strings

◆ toLowercase()

static std::string StringHelper::toLowercase ( const std::string &  input)
static

Function converts uppercase letter to lowercase.

Parameters
inputstring
Returns
lowercase string

◆ toUppercase()

static std::string StringHelper::toUppercase ( const std::string &  input)
static

Function converts lowercase letter to uppercase.

Parameters
inputstring
Returns
uppercase string

◆ trim()

static std::string StringHelper::trim ( const std::string &  input)
static

Function removes blank and control characters (such as line feed) from the start and end of a string.

Parameters
inputstring
Returns
changed string

The documentation for this class was generated from the following file: