Get multiple fields at end of line
Posted: 21 Feb 2021, 13:38
I read a line in from a file to which I then split up into an array
I am happy with l1, l2, l3 like this as they have specific meanings, but I would like to populate l4 with "everything after l3" as that part can be a free form string with many spaces in it. How could I do this? Do you think building the string "%l1% %l2% %l3%", and then split the line on that string so that I get the latter part of the string would be efficient or are there better ways?
Also, am I using the *wrong kind* of array here? There is a more modern way of doing arrays I think? (Autohotkey often has the "old way" and "new way" of doing things of course!).
Code: Select all
GetTag(tag) {
FileRead, pwd, %PwdFile%
Loop, read, %PwdFile%
{
line = %A_LoopReadLine%
arrx := StrSplit(line, " ")
l1 := % arrx.1
l2 := % arrx.2
l3 := % arrx.3
l4 := % arrx.4
Also, am I using the *wrong kind* of array here? There is a more modern way of doing arrays I think? (Autohotkey often has the "old way" and "new way" of doing things of course!).