Now I have two functions, but is it possible to use the same function?
Example of a datafile Test.csv
Code: Select all
"Field1";"Field2";"Field3"
"aaa";"bbb";"ccc"
Code: Select all
InputFile = Test.csv
Result := ReadFile(InputFile)
MsgBox %Result%
ReadFile(FileName)
{ Loop Read, %FileName%
MsgBox % A_LoopReadLine
Return "Result from File"
}
Code: Select all
TestValue =
(LTrim Join
"Field11";"Field12";"Field13"`n
"AAA";"BBB";"CCC"
)
Result1 := ReadData(TestValue)
MsgBox %Result1%
ReadData(Data)
{ Loop Parse, Data, `n
MsgBox % A_LoopField
Return "Result from Data"
}
For a file, this is used .: Loop Read,... and A_LoopReadLine and
for Data, this is used .: Loop Parse,... and A_LoopField
Is it possible to do both thing with the same function?