mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Convert to lower case before compare
This commit is contained in:
parent
fd785044eb
commit
4016681286
@ -135,7 +135,7 @@ bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
|
|||||||
sMonth = trimString(sMonth);
|
sMonth = trimString(sMonth);
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (MONTH_NAMES[i].compare(0, s.size(), s) == 0)
|
if (MONTH_NAMES[i].compare(0, sMonth.size(), sMonth) == 0)
|
||||||
{
|
{
|
||||||
month = i + 1;
|
month = i + 1;
|
||||||
return true;
|
return true;
|
||||||
@ -192,10 +192,13 @@ bool RiaDateStringParser::containsAlphabetic(const std::string& s)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::string RiaDateStringParser::trimString(std::string& s)
|
std::string RiaDateStringParser::trimString(const std::string& s)
|
||||||
{
|
{
|
||||||
auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1);
|
auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1);
|
||||||
sCopy = sCopy.substr(sCopy.find_first_not_of(' '));
|
sCopy = sCopy.substr(sCopy.find_first_not_of(' '));
|
||||||
|
|
||||||
|
std::transform(sCopy.begin(), sCopy.end(), sCopy.begin(), ::tolower);
|
||||||
|
|
||||||
return sCopy;
|
return sCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,6 @@ private:
|
|||||||
static bool tryParseDay(const std::string& s, int &day);
|
static bool tryParseDay(const std::string& s, int &day);
|
||||||
|
|
||||||
static bool containsAlphabetic(const std::string& s);
|
static bool containsAlphabetic(const std::string& s);
|
||||||
static std::string trimString(std::string& s);
|
static std::string trimString(const std::string& s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user