Added randomutils and fixed some str utils

This commit is contained in:
2021-09-05 21:07:47 +02:00
parent 680cbcccfa
commit 56635e611d
4 changed files with 72 additions and 10 deletions
+3 -10
View File
@@ -1,14 +1,11 @@
#include "strutils.h"
// system includes
#include <algorithm>
#include <cctype>
namespace cpputils {
bool stringEqualsIgnoreCase(std::string_view a, std::string_view b)
{
return a == b; // HACK for now...
if (a.size() != b.size())
return false;
@@ -25,14 +22,10 @@ bool stringStartsWith(std::string_view fullString, std::string_view begin)
bool stringEndsWith(std::string_view fullString, std::string_view ending)
{
if (fullString.length() >= ending.length())
{
return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
}
else
{
if (fullString.length() < ending.length())
return false;
}
return fullString.compare(fullString.length() - ending.length(), ending.length(), ending) == 0;
}
//void stringReplaceAll(char search, char replace, std::string &subject)