preload

ParametersToStr (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jan 03, 2009 | Categories: Associative ArraySource code

Parent page: Service Functions – Dictionary (QTP, TestComplete, VBScript)

Description

Does exactly opposite what AssociateParameters does – converts a Dictionary back to the string of pairs. Special characters are treated.

Implementation

Public Function ParametersToStr(ByRef objDictionary)
  Dim Iter, dvKeys
  Dim sParameter, sKey, sValue

  sParameter = ""
  dvKeys = objDictionary.Keys()

  For Iter = 0 To UBound(dvKeys)
  	    sKey = dvKeys(Iter)
		sValue = Replace(objDictionary.Item(sKey), ",", "\,")
		sValue = Replace(sValue, "=", "\=")
		sKey = Replace(sKey, ",", "\,")
		sKey = Replace(sKey, "=", "\=")
		sParameter = Add2List(sParameter, sKey & " = " & sValue, ", ")
  Next

  ParametersToStr = sParameter
End Function


Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.