Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Apr 22, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Duplicate the Join Function for VB4 and VB5

The native VB6 Split and Join functions have highlighted a number of useful techniques, and VB5 and VB4 programmers can use this extended facility as well. This code emulates the Join function of VB6 for use in earlier versions. This function takes in an array of information and gives a String as output with delimiters per the user request:
Public Function Join(arr As Variant, Optional _
ByVal delimiter) As String
Dim sRet As String
Dim i As Integer
If IsArray(arr) Then
If IsMissing(delimiter) Then
delimiter = " "
ElseIf Len(CStr(delimiter)) = 0 Then
delimiter = ""
delimiter = CStr(delimiter)
End If
For i = LBound(arr) To UBound(arr)
sRet = sRet & arr(i) & delimiter
Next i
End If
Join = Left(sRet, Len(sRet) - Len(delimiter))
End Function
G. Ajay
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date