Visual Basic 6 function "implode"

Go back

Below you'll find the source for the Visual Basic 6 function implode.

Attribute VB_Name = "modImplode"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
' 
' You may freely distribute this file but please leave all comments, including this one, in it.
' 
' @Author Stefan Thoolen <mail@stefanthoolen.nl>

Option Explicit

''
' Places an array in a string, with a delimiter char
' Same syntax as the PHP function 'implode'
' See also: http://www.php.net/manual/en/function.implode.php
' @param    String  glue        This string must be placed between all pieces
' @param    Variant pieces      An array containing all pieces
' @return   String              All pieces glued and combined
' @author   Stefan Thoolen <mail@stefanthoolen.nl>
Public Function implode(glue As String, pieces() As Variant) As String
    ' I wrote this function but later I discovered the built-in function join()
    ' I kept this for compatibility reasons
    implode = Join(pieces, glue)
End Function