'********************************************************************

'*

'* Function CSVJoin

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2008-05-24

'* Modified: 2008-05-24

'*

'* Purpose: Returns an comma delimited string from an array with the

'*             individual values in quotes (or another qualifier).

'*             This is similar to the VBScript Join function.  However,

'*             this function qualifies the individual values as well.

'*

'* Input:  aryAny        Any Array of values.

'*         strDelimiter  The delimiter for the values in the array.

'*                         Default = ","

'*         strQualifier  The qualifier for the values.

'*                         Default is none (Empty)

'*

'* Output:  Returns an comma delimited string from an array with the

'*             individual values in quotes (or another qualifier).

'*          Returns Empty if aryAny is not an Array

'*

'* Changes:

'********************************************************************

Function CSVJoin(ByRef aryAny, ByVal strDelimiter, ByVal strQualifier)

  'Version 1.0 2008-05-24

  Dim x, strNew

 

  'Set default if not specified

  If Len(strDelimiter) = 0 Then strDelimiter = ","

 

  If IsArray(aryAny) Then

    strNew = strQualifier & Join(aryAny, strQualifier & strDelimiter & _

               strQualifier) & strQualifier

  Else

    strNew = Empty

  End If 'IsArray(aryAny)

  CSVJoin = strNew

End Function 'CSVJoin

Article ID: 378, Created On: 9/25/2011, Modified: 9/25/2011