Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday, 5 January 2019

Finding Length of the String without using Len Function

Method-1
----------------------------------

str1="ABCDEFG"

var=InStrRev(str1,Right(str1,1))
MsgBox var


Method-2
----------------------------------

strVal = InputBox("please enter any value")

msgbox len(strVal)

  for i=1 to 1000
       val = mid(strVal ,1,i)
       msg=msg & val & vbnewline
       arrVar = split(msg,vbnewline)
       blnres = arrVar(i-1)
     
       If blnres = strVal then
           msgbox "The length of the given string is :=  "& i
          exit for
       End if
Next


Method-3
----------------------------------

str="ABCDEFG"

i=0
Do Until str=""
   i= i+1
   b=Left(str,1)
   str=Replace(str,b,"")
Loop

MsgBox i