Just like VB.NET, Should be fine in any b4x language.
Name: Join, Join2
Description: Joins a list or array in a single string.
Dependencies: None
Tags: String
Name: Join, Join2
Description: Joins a list or array in a single string.
B4X:
'--- joins a list together as a string
'--- if you do not want a join char then pass in ""
Public Sub Join(lst As List, joinChar As Object) As String
Dim retStr As StringBuilder
retStr.Initialize
For Each str In lst
retStr.Append(str).Append(joinChar)
Next
Return retStr.ToString
End Sub
'--- joins a array together as a string
'--- if you do not want a join char then pass in ""
Public Sub Join2(arr() As String, joinChar As Object) As String
Dim retStr As StringBuilder
retStr.Initialize
For Each str In arr
retStr.Append(str).Append(joinChar)
Next
Return retStr.ToString
End Sub
Dependencies: None
Tags: String