mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
Move string transform
This commit is contained in:
parent
2f4bc7301d
commit
044dbb14a7
@ -162,6 +162,9 @@ bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
|
|||||||
{
|
{
|
||||||
auto sMonth = s;
|
auto sMonth = s;
|
||||||
sMonth = trimString(sMonth);
|
sMonth = trimString(sMonth);
|
||||||
|
std::transform(sMonth.begin(), sMonth.end(), sMonth.begin(),
|
||||||
|
[](const char c) -> char { return (char)::tolower(c); });
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (MONTH_NAMES[i].compare(0, sMonth.size(), sMonth) == 0)
|
if (MONTH_NAMES[i].compare(0, sMonth.size(), sMonth) == 0)
|
||||||
@ -210,8 +213,5 @@ 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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user