Added randomutils and fixed some str utils
This commit is contained in:
+3
-10
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user