am trying convert string to float,when i am passing single char it is giving exceptions.
FMandateSize := StrToFloat(EditMandateSize.Text);
any idea how to convert single char to float?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What floating point value would you expect from a space character? Probably 0.0.
You could use StrToFloatDef to assign your own default value for invalid strings:
Or you could use TryStrToFloat which gives you a boolean result instead of throwing an exception when there’s an invalid string.