See Also: Array Functions, Array Variable Assignments, String Functions, Working with Arrays, StrSplitToArray
Appends contents of elements of a String array to a single String.
StrJoinFromArray( {StringArray}, {Delimiter} )
Where:
{StringArray} is the DataFlex String array containing the elements to append.
{Delimiter} to use to separate the appended strings. Can be any ASCII character, e.g. comma (,), period (.), etc.. You can use "" if you do not want the resulting String to be delimited.
StrJoinFromArray appends all elements in a String array to a single String, separated by the specified delimiter.
This sample appends the elements in String array Flintstones to the String variable sNames, separated by commas: "Fred,Wilma,Betty,Barney".
Procedure Test
String[] Flintstones
String sNames
Move "Fred" to Flintstones[0]
Move "Wilma" to Flintstones[1]
Move "Betty" to Flintstones[2]
Move "Barney" to Flintstones[3]
Move (StrJoinFromArray(Flintstones, ",")) to sNames
End_Procedure
Note that the resulting String is in the same order as the elements in the source array. If you would like the resulting string to be sorted, you need to sort the array (using SortArray) before calling StrJoinFromArray. The result will be: "Barney,Betty,Fred,Wilma".
Procedure Test
String[] Flintstones
String sNames
Move "Fred" to Flintstones[0]
Move "Wilma" to Flintstones[1]
Move "Betty" to Flintstones[2]
Move "Barney" to Flintstones[3]
Move (SortArray(Flintstones)) to Flintstones
Move (StrJoinFromArray(Flintstones, ",")) to sNames
End_Procedure