Tuesday, 17 May 2011

Find the length of the string without using strlen() function :

str="abcde"
x=Mid(str,1,1)
For i=1 to 100
 pos=instr(str,x)
 pos=pos+1
 x=Mid(str,pos,1)
 Leng=pos-1

 If x="" Then
  Exit For
 End If
Next
Msgbox "Lenght of the string" & "=" & Leng

No comments:

Post a Comment