StrJoinFromArray

See Also: Array Functions, Array Variable Assignments, String Functions, Working with Arrays, StrSplitToArray

Purpose

Appends contents of elements of a String array to a single String.

Return Type

String

Syntax

StrJoinFromArray( {StringArray}, {Delimiter} )

Where:

What it Does

StrJoinFromArray appends all elements in a String array to a single String, separated by the specified delimiter.

Example

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