dsdsdsdsd wrote:I am searching for the longest row in the .csv, ie mnoc(max_number_of_columns);
this seems like a terribly inefficient way to count the 'length' of each row in a .csv file;
I didn't say anything yet because I figured some guru was going to tell you about the count_columns_in_a_csv_file() function and anything I said would just make me look stupid.
But since no one's said anything yet, I'll say it:
I can't imagine any method for this that wouldn't involve reading every line and counting the columns, comparing it to a maxColumns variable, and ending up with a result. This is what you have done.
There's probably a more efficient function for one piece or another, but your biggest hit is reading the file and you can't get around that, so any increase in the effiency of counting the columns isn't going to buy you much.
The good news is that you've put it in a function, so if you discover a better way to do it, you can just update your function. And for now, I doubt it's a performance hog anyway.
My two cents worth, cheerfully refunded if not fully satisfied.