file with different var types lazarus / 61-Beginners ---------------------------------------------------------------------- purger · 2016-01-14 05:16 hi, i have textfile with names and numbers. I need to create gui app that will make average of the numbers (somehow to ignore the text) thanks ---------------------------------------------------------------------- balazsszekely · 2016-01-14 05:29 1. Load the textfile into a TStringList 2. Loop through TStringList each line and split the text into separate words 3. Try to convert each word to integer with StrToIntDef function, if succeed then copy the integers into a temp. array 4. Calculate the average of the array PS: Feel free to ask more questions if you like. ---------------------------------------------------------------------- engkin · 2016-01-14 06:02 Or use the following regular expression to get the numbers, integer or not: (\b[0-9]+(\.[0-9]+)?\b) Taking care of the sign is left as an exercise! ---------------------------------------------------------------------- User137 · 2016-01-14 11:14 This is a homework excercise right? I don't know any real file format that would have structure like that. Even a string variable can be "12374618".