Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
String Function - ExtractThis function extracts a substring from a target-string delimited by a from-string and a to-string. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function zStr_Extract(sTemp, sFrom, sTo) Dim iLen, iPosn, sLine iLen = Len(sFrom) iPosn = inStr(sTemp,sFrom) If iPosn = 0 Then Print "zStr_Extract - Failed - From String Not Found" zStr_Extract = "" Exit function End If sLine = Mid(sTemp,iPosn+iLen) iPosn = inStr(sLine,sTo) If iPosn = 0 Then Print "zStr_Extract - Failed - To String Not Found" zStr_Extract = "" Exit function End If sLine = Left(sLine,iPosn-1) zStr_Extract = sLine End Function '========================================================================= |