preload

GetTokenByNumber (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Mar 05, 2012 | Categories: Source codeText Data

Parent page: Service Functions – String (QTP, VBScript)

Description

Get token string from the source string. Position is absolute, defined by number.

Implementation

Public Function GetTokenByNumber(ByVal strSource, ByVal chrDelimiter, ByVal intNumber, ByRef strToken)
	Dim Tokens, intCount

	strSource = ReplaceEx(strSource, "  *", " ", False)
	Tokens = Split(strSource, chrDelimiter)
	intCount = UBound(Tokens)

	If  intNumber > intCount Then
		GetTokenByNumber = FALSE
		Exit Function
	End If

	strToken = Tokens(intNumber-1)
	GetTokenByNumber = TRUE
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.