mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 11:28:17 +00:00
Update rtext.c
This commit is contained in:
@@ -1471,13 +1471,14 @@ float TextToFloat(const char *text)
|
|||||||
text++;
|
text++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
int i = 0;
|
||||||
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
||||||
|
|
||||||
if (text[i++] != '.') value *= sign;
|
if (text[i++] != '.') value *= sign;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float divisor = 10.0f;
|
float divisor = 10.0f;
|
||||||
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
||||||
{
|
{
|
||||||
value += ((float)(text[i] - '0'))/divisor;
|
value += ((float)(text[i] - '0'))/divisor;
|
||||||
divisor = divisor*10.0f;
|
divisor = divisor*10.0f;
|
||||||
|
Reference in New Issue
Block a user