getTrailingNumber("string") and stripTrailingNumber("string") will now work for single letter cases. For example, getTrailingNumber() will return "11" if the input is "a11" or "t11", and stripTrailingNumber() will return "a" if the input is "a11".
This commit is contained in:
klaus95 2017-04-17 15:46:44 -07:00 committed by GitHub
parent b052a1f970
commit d6fd1a49ca

View file

@ -1620,7 +1620,7 @@ String String::GetTrailingNumber(const char* str, S32& number)
if ((*p == '-') || (*p == '_'))
number = -dAtoi(p + 1);
else
number = ((p == base.c_str()) ? dAtoi(p) : dAtoi(++p));
number = (isdigit(*p) && (p == base.c_str()) ? dAtoi(p) : dAtoi(++p));
// Remove space between the name and the number
while ((p > base.c_str()) && dIsspace(*(p-1)))