06 November 2017

Count No.of Word in a Sentence without using Split function in UFT

Using Split Function:

str = "simple is sample str"

b = Split(str)
MsgBoxUBound(b)+1   'Returns 4



Without using Split Function:

str = "simple is sample str"
count = 1

For i = 1ToLen(str)
    
    b = Mid(str, i, 1)
    
    IfNot b = " "Then
        t = t &b
        Else
        count = count+1
    EndIf
    
Next

MsgBox count    'Returns 4



...

No comments:

Post a Comment

AOM - Automation Object Model

'Creating QuicTest Object Set  qtapp =  createobject ( "QuickTest.Application" ) 'Launching the Application If  qtapp...