I have a text file that has, on any given row, data that are expressed both in text format and in numeric format. Something like this:
Dog 5 4 7
How do I write a file reading routine in Delphi that reads this row and assigns the read values into the correct variables (“Dog” into a string variable and “5”, “4” and “7” into real or integer variables)?
You can use
SplitStringfromStrUtilsto split the string into pieces. And then useStrToIntto convert to integer.And obviously substitute
StrToFloatif you have floating point values.