Skip to main content
NetworkAdminKB Logo

VBScript Library

Go Search
NetworkAdminKB.com
Knowledge Base
VBScript Library
Utilities
  
NetworkAdminKB.com > VBScript Library > Knowledge Base > Components > Strings > CSVJoin  

CSVJoin

Article Content

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

'*

'* 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

Keywords
String Conversion 
Related Articles
 
Last modified at 11/1/2009 12:41 PM  by TEMPLATE\kbadmin 
 
 NetworkAdminKB.com
 Copyright © 2008 NetworkAdminKB.com, All rights reserved. Terms of Use | Contact US