Concatenate string

Hello,
I have to concatenate the for-next loop values into a string format as :

for i=1 to n
  x(i) = ...
  y(i) = ...
  z(i) = ...
Next

strfrm = str( x(1) +","+(y(1)+","+z(1)+ “;” +x(2)+","+y(2)+",“z(2)+ “;” +x(3)+”,"+y(3)+","+z(3)+ “;” … “;” + x(n) +","+y(n)+","z(n))

strfrm is the input of a nx3 (n rows,3 columns) Matrix.

Is there any Xojo function to do this task, or any other solution ?

strfrm = ""
for i=1 to n
  x(i) = ...
  y(i) = ...
  z(i) = ...
  strfrm = strfrm + str( x(i) + "," + y(i)+ "," + z(i) )
  If i < n Then
    strfrm = strfrm + ";"
  End If
Next
  1. Please consider adding strings to array and later use join for better performance.
  2. it doesn’t make sense to pass string to str() function.

[code]Dim arr() As String

For i As Integer = 1 To n
x(i) = …
y(i) = …
z(i) = …
arr.Append(Str(x(i)) + “,” + Str(y(i)) + “,” + Str(z(i)))
Next

Dim result As String = Join(arr, “;”)[/code]

[code]
n=3
strfrm = “”
for i=1 to n
x(i) =gha(i)*trigo.rad
y(i) =dec(i)*trigo.rad
z(i) =ht(i)*trigo.rad
strfrm =strfrm + str( str(x(i)) + “,” + str(y(i))+ “,” + str(z(i)) )
If i < n Then
strfrm = strfrm + “;”
End If
Next

system.debugLog " strfrm : " + strfrm[/code]

Dim arr() As String

For i As Integer = 1 To n
  x(i) = ...
  y(i) = ...
  z(i) = ...
  arr.Append(Str(x(i)) + "," + Str(y(i)) + "," + Str(z(i)))
Next

Dim result As String = Join(arr, ";")
system.debugLog " result : " + result

Two codes are running properly, thanks everybody !

output : 1.433032,0.6757566,0.931744;0.3353353,-0.5241224,0.2762856;5.033413,0.8013976,0.3682069