QTP Math functions – Array/Set Conversions
Parent page: Service Functions – Math (QTP, VBScript)
Convert array to set
Public Function Array2Set(ByVal dvArray, ByVal sSetSeparator) Dim Iter Dim stResult If Not isArray(dvArray) Then Array2Set = "" Exit Function End If If UBound(dvArray) = -1Then Array2Set = "" Exit Function End If If sSetSeparator = "" Then sSetSeparator = chrSetSeparator End If stResult = CStr(dvArray(0)) For Iter=1 To UBound(dvArray) stResult = stResult & sSetSeparator & CStr(dvArray(Iter)) Next Array2Set = stResult End Function
Convert set to array
Public Function Set2Array(ByVal stSet, ByVal sSetSeparator) Dim Iter, dvArray If sSetSeparator = "" Then sSetSeparator = chrSetSeparator End If dvArray = Split(stSet, sSetSeparator) For Iter=0 To UBound(dvArray) dvArray(Iter) = Trim(dvArray(Iter)) Next Set2Array = dvArray End Function