Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
Convert a String to Float
-
i want to read a number from a text file on my hard drive, containing only this number
i wrote this
hcal = IO.read("C;\\...txt").chomp hcal.to_fbut when i check
hcal.classhcal is still a string, not a float...
can you tell me where is my mistake?
-
hcal = IO.read("file.txt").strip.to_f -
hcal.to_fdoesn't modifyhcal, it returns a float. So you need to write it like so:hcal = hcal.to_f -
@thomthom said:
hcal.to_fdoesn't modifyhcal, it returns a float. So you need to write it like so:hcal = hcal.to_fthanks to both you...
yes, both codes work nicely; i spent 3 hours to look for a solution, and i get 2 different, in a few minutes, on sketchucation...
learning ruby on the internet is an exciting experience
Advertisement