Parcourir la source

Fix for bug #1738

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".
klaus95 il y a 8 ans
Parent
commit
5378abfc55
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      Engine/source/core/util/str.cpp

+ 1 - 1
Engine/source/core/util/str.cpp

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