mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 08:59:07 +00:00
feat(str): add SStrToUnsigned
This commit is contained in:
parent
e19e394a79
commit
2408166d5d
3 changed files with 72 additions and 0 deletions
|
|
@ -678,6 +678,22 @@ int32_t SStrToInt(const char* string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32_t SStrToUnsigned(const char* string) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(string);
|
||||
STORM_VALIDATE_END;
|
||||
|
||||
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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue