06 November 2017

Get Length of the String without using Len Function ( 2 different ways )

Option 1:

str = "ABCDEFG"

var = InStrRev(str, Right(str,1))


MsgBox var 'Return 7 - position of G


Option 2:

str = "ABCDEFG"
i = 0
DoUntil str = ""
    i = i+1
    b = Left(str, 1)
    str = Replace(str, b, "")
Loop


MsgBox i   'Return 7


...

1 comment:

  1. In 2nd solution, you will have problems if you have repeating characters rite?

    ReplyDelete

AOM - Automation Object Model

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