|Welcome to the Monastery|
What's the first arg to split()? It appears to be a single blank char. How does that work to split upon tab chars?
It's a space enclosed within single quotes. It tells split to split on whitespace, e.g., \t, \n, space.
In trySplitSliceLimit, wouldn't it be better to set LIMIT to 3, or in general to the number of fields you expect to extract?
It should be set to the number of fields plus one that are needed to get the fields you want. For example, using your original string:
You want LAST FIRST CITY and CITY is the sixth field. Setting the LIMIT to seven will return the first six fields and the remainder of the string is the seventh. The slice is then used on those seven to get only the three you want.
And one observation for the record: the indices can appear in any order. To extract LAST, FIRST, and CITY, you'd write [2, 0, 5]
Update: Changed splitting on ' ' to \t. Thanks CountZero.
In reply to Re^3: selecting columns from a tab-separated-values file