13 #pragma warning(disable : 4996) // Windows code: unsafe 18 #include <type_traits> 59 bool stFindNoCase(
const std::string&,
const std::string&);
62 const std::string& a_delimiterList = ST_WHITESPACE,
63 bool a_delimiterCompressOn =
true);
64 VecStr stExplode(
const std::string& source,
const std::string& a_delimiterString);
65 std::string
stImplode(
const std::vector<std::string>& source,
const std::string& delim);
68 std::string&
stLeft(std::string& a_source,
size_t const a_length);
69 std::string
stLeftCopy(
const std::string& a_source,
size_t const a_length);
71 std::string&
stRemove(std::string& str,
char source);
72 std::string
stRemoveCopy(
const std::string& str,
char source);
74 std::string&
stReplace(std::string& str,
char source,
char dest);
75 std::string&
stReplace(std::string& str,
const std::string& source,
const std::string& dest);
76 std::string
stReplaceCopy(
const std::string& str,
char source,
char dest);
78 const std::string& source,
79 const std::string& dest);
81 std::string&
stRight(std::string& a_source,
size_t const a_length);
82 std::string
stRightCopy(
const std::string& a_source,
size_t const a_length);
85 bool stContains(
const std::string& a_container,
const std::string& a_substr);
93 std::string&
stTrim(std::string& str,
const std::string& delim = ST_WHITESPACE);
94 std::string
stTrimCopy(
const std::string& str,
const std::string& delim = ST_WHITESPACE);
95 std::string&
stTrimLeft(std::string& str,
const std::string& delim = ST_WHITESPACE);
96 std::string&
stTrimRight(std::string& str,
const std::string& delim = ST_WHITESPACE);
100 unsigned int stCountChar(
const std::string& str,
char c);
104 bool stMakeUnique(
const std::set<std::string>& set_str, std::string& str);
105 bool stStringToInt(
const std::string&,
int& i,
int base = 0);
108 int stPrecision(
double value,
int& flags,
int length = 15);
112 std::string
STRstd(
double a_value,
int a_n = -1,
int width = 15,
int flags = 0);
113 std::string
STRstd(
float a_value,
int a_n = -1,
int width = 15,
int flags = 0);
126 template <
typename T>
127 inline std::string
STRstd(T a_value,
int a_n = 0,
int width = 0,
int flags = 0)
129 static_assert(std::is_integral<T>::value,
"Not an integral (integer) type");
131 return STRstd((
double)a_value, a_n, width, flags);
134 std::string
STRstd(std::string a_value);
140 virtual char do_thousands_sep()
const;
141 virtual std::string do_grouping()
const;
int m_oldOutputFormat
Saved output format to restore to orignal value.
PrecFlags
Bitwise flags used by stPrecision(), and STR()
std::string stRemoveCopy(const std::string &str, char source)
Returns a copy of str with all instances of char source removed.
std::string & stTrimLeft(std::string &str, const std::string &delim)
Trims the leading delim characters from a string.
std::string & stLeft(std::string &a_source, size_t const a_length)
Modifies a_source to contain the first (leftmost) a_length characters.
std::string & stToUpper(std::string &str)
Modifies str to be all uppercase.
int stPrecision(double value, int &flags, int length)
Returns precision, or the number of digits to the right of the decimal needed to display the [value]...
std::string STRstd(double a_value, int a_n, int width, int flags)
Get a properly formatted string from a double.
std::string & stTrim(std::string &str, const std::string &delim)
Trim the leading and trailing delim characters from a string.
bool stScientificNotation(const std::string &str, bool check_numeric)
Determines whether the given string is a number in scientific notation.
std::string stReplaceCopy(const std::string &str, char source, char dest)
Returns a copy of str with every instance of source replaced with dest.
std::string stToLowerCopy(const std::string &str)
Returns a new string that is str with all characters lowercase.
bool stVectorContainsString(const VecStr &a_container, const std::string &str)
Checks if a vec of strings contains a string. Case sensitive.
std::vector< std::string > VecStr
short rename
std::string stToUpperCopy(const std::string &str)
Returns a new string that is str with all characters uppercase.
std::string & stRight(std::string &a_source, size_t const a_length)
Modifies a_source to contain the last (rightmost) a_length characters.
bool stStringToDouble(const std::string &s, double &d)
Convert a string to an double.
StTemp2DigitExponents()
Temporarily output 2-digit exponents for floating point numbers to match C++ standard. Should be able to remove all instances of this class upon moving to Visual Studio 2015.
std::string stLeftCopy(const std::string &a_source, size_t const a_length)
Extracts first (leftmost) a_length characters from a_source returning a copy.
std::string stSimplified(const std::string &str)
Removes all white space from the passed string.
Used to format numbers with comma separators.
int stIndexOfElem(const VecStr &a_container, const std::string &str)
Iterates through a vec of strings and looks for the string. Case sensitive.
When constructed std::cout will temporarily output 2-digit exponents for floating point numbers...
bool stFindNoCase(const std::string &a, const std::string &b)
Returns true if a contains b while ignoring capitalization.
std::string & stReplace(std::string &str, char source, char dest)
Returns a reference to str, and replaces every instance of source replaced with dest.
std::string stImplode(const std::vector< std::string > &source, const std::string &delim)
Joins the vector, inserting delim between each item.
std::string & stToLower(std::string &str)
Modifies str to be all lowercase.
std::string stTrimCopy(const std::string &str, const std::string &delim)
Trims the white space from a string. This involves creating a copy of the string (twice I believe)...
~StTemp2DigitExponents()
Revert back to 3-digit exponents for pre-Visual Studio 2015.
static const char * ST_WHITESPACE
Whitespace characters.
std::string stRightCopy(const std::string &a_source, size_t const a_length)
Extracts last (rightmost) a_length characters from a_source returning a copy.
std::string & stTrimRight(std::string &str, const std::string &delim)
Trims the trailing delim characters from a string.
bool stMakeUnique(const std::set< std::string > &set_str, std::string &str)
Changes str to "str (2)" etc. if it is in set of set_str.
VecStr stExplode(const std::string &source, const std::string &a_delimiter)
Breaks the string into a vector of strings based on the delimiter.
bool stNumeric(const std::string &str)
Determines whether the given string is a valid number.
VecStr stSplit(const std::string &a_source, const std::string &a_delimiterList, bool a_delimiterCompressOn)
Breaks string into vector of strings based on one or more delimiters.
bool stEqualNoCase(const std::string &a, const std::string &b)
Returns true if a and b are equal while ignoring capitalization.
bool stContains(const std::string &a_container, const std::string &a_substr)
Checks if first string contains second. Case insensitive.
Vector types for convenience.
void stChangeExtendedAscii(std::string &str, bool to_extended)
Replaces the Windows Latin-1 extended ASCII characters with standard ASCII and vice-versa.
unsigned int stCountChar(const std::string &str, char c)
Counts the number of a given character in a string.
std::string & stRemove(std::string &str, char source)
Removes all instances of char source from str and returns a reference to str.
bool stStringToInt(const std::string &s, int &i, int base)
Convert a string to an int.