how to create isStringFloat?
how to create a function that checks if string is exactly a float?
PHP Code:
|
Re: how to create isStringFloat?
PHP Code:
|
Re: how to create isStringFloat?
or floatstr, yeah, i know, but i remember when i did like this, if i set a string with 'a' a float would be returned as '4124142.42312' or something like that. not '0'
|
Re: how to create isStringFloat?
Quote:
There's is_str_float() in String Stocks. |
Re: how to create isStringFloat?
PHP Code:
Oh, so just like my code. thanks :) |
Re: how to create isStringFloat?
PHP Code:
TESTED AND WORKS CHARMING !!! |
Re: how to create isStringFloat?
on my eye
For your example Code:
a5.5a and also Code:
.5 i see you edited code. Code:
5.5. why? because "for" loop will pass by, but PHP Code:
|
Re: how to create isStringFloat?
Have you tested it?
Btw ik i+1 is equal to 5 but the contain native will ignore the previous '.' and start searching for a new one starting from that position which is (i+1 // 5), if it found an extra dot will return false remember contain native handles with a strings not a character new i = Contain(sString, ".") // will return 0 And why this will return 0 if it based on this 5.5. The correct result will be 1 |
Re: how to create isStringFloat?
I dont test it, because i'm not on pc with amxx
Code:
Btw ik i+1 is equal to 5 but the contain native will ignore the previous '.' and start searching for a new one starting from that position which is (i+1 // 5) Quote:
Code:
contain(sString[i+1],".") Will check if "5" contains "." which returns -1 ( false ) |
Re: how to create isStringFloat?
Quote:
Will check if the string "5." contains "." which will returns 1 |
All times are GMT -4. The time now is 16:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.