commonlib
stringhelper.h
1 
11 #pragma once
12 
13 #include <string>
14 #include <cstdarg>
15 #include <vector>
16 #include "datatypes.h"
17 
18 BEGIN_NAMESPACE_DATATYPES
19 
24 {
25 public:
32  static std::string format(const char* fmt, ...);
33 
39  static std::string toUppercase(const std::string& input);
40 
46  static std::string toLowercase(const std::string& input);
47 
54  static bool areSame(const std::string& lhs, const std::string& rhs);
55 
63  static void replaceAll(std::string& input, const std::string& oldStr, const std::string& newStr);
64 
71  static std::vector<std::string> tokenize(const std::string& input, char delimiter);
72 
78  static std::string lTrim(const std::string& input);
79 
85  static std::string rTrim(const std::string& input);
86 
92  static std::string trim(const std::string& input);
93 
94 
100  static std::string serialNumberToStr(uint64_t serialNumber);
101 
107  static std::wstring localEncodingToWide(const std::string& localStr);
108 };
109 
110 END_NAMESPACE_DATATYPES
static std::string format(const char *fmt,...)
Function works like printf function in CXX.
static std::wstring localEncodingToWide(const std::string &localStr)
localEncodingStrToUtf16Str Function converts local windows encoding string to utf16 string ...
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...
static std::string lTrim(const std::string &input)
Function removes blank and control characters (such as line feed) from the start of a string...
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.
The class StringHelper implements functions for handling strings.
Definition: stringhelper.h:23
static std::string serialNumberToStr(uint64_t serialNumber)
Function converts serial number to display string.
static bool areSame(const std::string &lhs, const std::string &rhs)
Function compares two strings by ordinal value without case sensitivity.
static std::string toLowercase(const std::string &input)
Function converts uppercase letter to lowercase.
static std::string toUppercase(const std::string &input)
Function converts lowercase letter to uppercase.
static std::string rTrim(const std::string &input)
Function removes blank and control characters (such as line feed) from the end of a string...
static std::vector< std::string > tokenize(const std::string &input, char delimiter)
Function returns the list strings separated by the delimiter value.