Core Library  1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
StringUtils.h File Reference

File containing declarations relating various string utilities. More...

#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <vector>
#include <limits>
#include <cmath>
#include "CoreLibraryDllGlobal.h"
#include "Platform/PlatformDefines.h"

Go to the source code of this file.

Namespaces

 core_lib
 The core_lib namespace.
 
 core_lib::string_utils
 The string_utils namespace.
 

Enumerations

enum  core_lib::string_utils::eSplitStringResult { core_lib::string_utils::eSplitStringResult::trimmed, core_lib::string_utils::eSplitStringResult::notTrimmed }
 Split string options enumeration. More...
 
enum  core_lib::string_utils::eFloatStringFormat { core_lib::string_utils::eFloatStringFormat::normal, core_lib::string_utils::eFloatStringFormat::fixed, core_lib::string_utils::eFloatStringFormat::scientific }
 Format float options enumeration. More...
 

Functions

void CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::PackStdString (std::string &line)
 Tidy a string obtained from getline function. More...
 
void CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::SplitString (std::string &subStr1, std::string &subStr2, const std::string &toSplit, const std::string &delim, eSplitStringResult option)
 Split a string into two parts given delimiters. More...
 
template<typename T >
std::string core_lib::string_utils::FormatFloatString (const T value, const int precision=15, eFloatStringFormat formatting=eFloatStringFormat::normal)
 Convert a floating point value to a formatted string representation. More...
 
template<typename T >
std::string core_lib::string_utils::AutoFormatFloatString (const T value, int decimalPlaces=1)
 Convert a floating point value to a string representation using the most suitable formatting. More...
 
std::wstring CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::RemoveIllegalChars (const std::wstring &text, const std::wstring &illegalChars=L"~#%&*{}<>?/+|\, wchar_t replacementChar=L '_')
 Return a string with any illegal chars replaced with replacement char. More...
 
std::string CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::RemoveIllegalChars (const std::string &text, const std::string &illegalChars="~#%&*{}<>?/+|\, char replacementChar='_')
 
std::wstring CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::StringToWString (const std::string &text)
 Convert a std::string to std::wstring. More...
 
std::string CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::WStringToString (const std::wstring &text)
 Convert a std::wstring to std::string. More...
 
bool CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::IsAlphaNumeric (const std::wstring &text)
 Return a flag to indicate whether string contains only alphanumeric chars. More...
 
bool CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::IsAlphaNumeric (const std::string &text)
 
template<typename Iter >
std::string core_lib::string_utils::MakeHexString (Iter first, Iter last, bool useUppercase, bool insertSpaces)
 Convert a range of data that is convertible to ints to a string of hex values. More...
 
std::vector< std::string > CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::TokeniseString (std::string const &text, std::string const &separator, bool keepEmptyTokens=false)
 Tokenise a string separated by a separator substring and split it into tokens. More...
 
std::string CORE_LIBRARY_DLL_SHARED_API core_lib::string_utils::ReplaceTokens (std::string const &text, std::map< std::string, std::string > const &tokenMap)
 Gieven a string containing tokens, replace tokens with specific string values. More...
 

Detailed Description

File containing declarations relating various string utilities.