GetTokenByNumber (QTP, TestComplete, VBScript)
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