I have a very long txt file to be imported into a database, and I need to define the longest possible field, VarChar(??)
I would like to Loop, Parse the var myF to get and MsgBox the longest number and content of longest line.
So far I have this. Sadly, I have forgotten how to Parse with incrementing var.
Code: Select all
FileRead, myF, myList.txt
;Get and Display length and content of Longest line in file.
myL =
myT =
Loop, Parse, myF, `n, `r
{
if (StrLen(A_LoopField) > StrLen(myL)) {
myL := StrLen(A_LoopField)
myT = %A_LoopField%
continue
}
else
{
myL := StrLen(A_LoopField)
}
}
MsgBox, 4096,, Longest myList.txt Line Content is: %myT% - Longest Line Length is: %myL%
ExitApp
Somehow you can Loop and keep, yet increment the detection vars.
Thanks,