|Welcome to the Monastery|
Re^3: parse a line with varied number of fieldsby johngg (Abbot)
|on Jul 03, 2012 at 22:30 UTC||Need Help??|
preserves multiple spaces in the file name
In case others are puzzled let's share the enlightenment and explain what is going on. The reason spaces are preserved is that the file name field is never actually split. First, the line is broken into nine fields.
Then the last field from the first split operation is reversed and broken into 10 fields.
Finally the last field from the second split operation is reversed to obtain the file name.
Note that spaces in the file name will be preserved but if the file name has leading and/or trailing spaces the method fails as they will be lost.