Custom Search

Wednesday, October 3, 2012

How to find length of the string without using Len function

str="FindLength"
'Here you need to add one single character which is not existed in your string
str=FindLengthr"
'here i had added one character "r" in the last of the string
msgbox instr(1,str,"r",1)-1

OtherWay:
str="VBSCRIPTING"
i=1
do
str1=mid(str,i,1)
if str1<>"" then
i=i+1
else
exit do
end if
loop until str1=""
msgbox i-1

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.