Sunday, 27 April 2014

QTP - UFT - How to count number of occurances of a string in a statement






We can use  regular expression.

Syntax
inputstring = "This String has multiple statements and each statement has multiple occurrences"
Set o1 = new RegExp
o1.pattern = "statement"
o1.ignorecase = true
o1.global = true
Set r1 = o1.execute(inputstring)
msgbox r1.count


1 comment:

  1. Thank you for taking the time to publish this information very useful! word counter tool

    ReplyDelete