BUG: stringOps::split with keepEmpty accidentally ignores non-empty trailing

- fixes #3025
This commit is contained in:
Mark Olesen 2023-11-07 22:06:13 +01:00
parent 0e3bb22088
commit 7766854a7e

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -120,7 +120,7 @@ Foam::SubStrings<StringType> Foam::stringOps::split
}
// Trailing element
if (keepEmpty ? (beg == str.size()) : (beg < str.size()))
if (keepEmpty ? (beg <= str.size()) : (beg < str.size()))
{
lst.append(str.cbegin() + beg, str.cend());
}
@ -156,7 +156,7 @@ Foam::SubStrings<StringType> Foam::stringOps::split
}
// Trailing element
if (keepEmpty ? (beg == str.size()) : (beg < str.size()))
if (keepEmpty ? (beg <= str.size()) : (beg < str.size()))
{
lst.append(str.cbegin() + beg, str.cend());
}