Converting a string to a float?
#1

Alright, Im trying to load a float from a MySQL table. The MySQL table has the value. When I try to load it by using strval(Field); it returns the value without anything beyond the decimal point. Example, getting the value 1800.125 from the MySQL table, gives that value 1800.0000. Can someone tell me a solution to this?
Reply
#2

%.0f will limit it down to 1 decimal point
Reply
#3

Trying to assign it to a variable, that has nothing to do with what i'm trying to do. float(strval(Field)); will not work either
Reply
#4

format(string, sizeof(string), "%.0f", w/e string variable);
new variable = strval(string);
Reply
#5

Wrong again, I did some searching, the answer is floatstr(string[]);
Reply
#6

Quote:
Originally Posted by NovaParadox
Wrong again, I did some searching, the answer is floatstr(string[]);
Thats the way i do it and it works fine for me, Why bother posting here before searching anyway?
Reply
#7

I added a word that wasnt needed and it made the search return no results
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)