joyceooi
asked on
Write array to text file in a single line
I have a multi-dimensional array data. The array is in
I wish to write it to a text file in a single line, which means in this format
"1","2","3".....
but not this format:
"1",
"2",
"3"
i try to loop through the array and store in a single string b4 write to file, but the output is not what I want...
"1,2,3,4,".....
I am using the write# function. any better suggestions? any idea to get the ideal output?
Thanks in advance.
I wish to write it to a text file in a single line, which means in this format
"1","2","3".....
but not this format:
"1",
"2",
"3"
i try to loop through the array and store in a single string b4 write to file, but the output is not what I want...
"1,2,3,4,".....
I am using the write# function. any better suggestions? any idea to get the ideal output?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use the Print #1, Yourstring
ASKER
Thanks FA
it works...
but there is an extra "," after the last data
it works...
but there is an extra "," after the last data
For i = 1 To 10
If i <> 10 Then
Write #1, s(i);
Else
Write #1, s(i)
End If
Next i
-FA
If i <> 10 Then
Write #1, s(i);
Else
Write #1, s(i)
End If
Next i
-FA
Or it is better:
For i = 1 To 9
Write #1, s(i);
Next i
Write #1, s(i)
For i = 1 To 9
Write #1, s(i);
Next i
Write #1, s(i)