i have a string array called Files, and a boolean function IsGood(Files[i]) in a for loop. How can i create an array of GoodFiles using IF.
Share
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.
Assuming I’m understanding you correctly, if you really must have an array you would first have to iterate over your Files array, calling IsGood on each one, and count how many good ones you have, allocate the array, then loop again, this time storing the good ones into the array.
There’s another data structure, TStringList, however, that you can conveniently use for something like this: