feat(string): implement SStrToUnsigned

This commit is contained in:
phaneron 2024-12-24 14:08:06 -05:00
parent 22e9686d64
commit eb26539b33
3 changed files with 66 additions and 0 deletions

View file

@ -669,6 +669,20 @@ int32_t SStrToInt(const char* string) {
return result;
}
uint32_t SStrToUnsigned(const char* string) {
STORM_ASSERT(string);
uint32_t result = 0;
uint32_t digit;
while ((digit = *string - '0') < 10) {
result = digit + (10 * result);
string++;
}
return result;
}
void SStrUpper(char* string) {
while (*string) {
*string = static_cast<char>(toupper(*string));

View file

@ -41,6 +41,8 @@ float SStrToFloat(const char* string);
int32_t SStrToInt(const char* string);
uint32_t SStrToUnsigned(const char* string);
void SStrUpper(char* string);
#endif