StringTools.h
Go to the documentation of this file.
#pragma once
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
namespace Hazelnp
{
class StringTools
{
public:
static bool Contains(const std::string& str, const char c);
static std::string Replace(const std::string& str, const char find, const std::string& subst);
static std::string Replace(const std::string& str, const std::string& find, const std::string& subst);
static bool IsNumeric(const std::string& str, const bool allowDecimalPoint = false);
static bool ParseNumber(const std::string& str, bool& out_isInt, long double& out_number);
static std::vector<std::string> SplitString(const std::string& str, const char delimiter);
static std::vector<std::string> SplitString(const std::string& str, const std::string& delimiter);
static std::string ToLower(const std::string& str);
};
}
Hazelnp::StringTools::Replace
static std::string Replace(const std::string &str, const char find, const std::string &subst)
Will replace a part of a string with another string.
Definition: StringTools.cpp:14
Hazelnp
Definition: DataType.h:3
Hazelnp::StringTools::IsNumeric
static bool IsNumeric(const std::string &str, const bool allowDecimalPoint=false)
Will return true if the given string consists only of digits (including signage)
Definition: StringTools.cpp:56
Hazelnp::StringTools::ParseNumber
static bool ParseNumber(const std::string &str, bool &out_isInt, long double &out_number)
Will convert the number in str to a number.
Definition: StringTools.cpp:82
Hazelnp::StringTools::Contains
static bool Contains(const std::string &str, const char c)
Will return wether or not a given char is in a string.
Definition: StringTools.cpp:5
Hazelnp::StringTools::SplitString
static std::vector< std::string > SplitString(const std::string &str, const char delimiter)
Will split a string by a delimiter char. The delimiter will be excluded!
Definition: StringTools.cpp:125
Hazelnp::StringTools
Internal helper class.
Definition: StringTools.h:11
Hazelnp::StringTools::ToLower
static std::string ToLower(const std::string &str)
Will make a string all lower-case.
Definition: StringTools.cpp:173