Hi,
please check with below code:
'Script to find the len of the given string without using the Len(Str)
function
Option Explicit
Dim Str
Str = Inputbox ( "Enter the String with spaces")
Msgbox "The entered string is:" & Str
Call LenOfString(Str)
Function LenOfString( Byref Str)
Dim cnt , sum , ubund, inx, sStr, Temp , Totlenofstr ,
sArry , sMid
cnt = 1
sum = 0
sArry = Split( Str , " ")
ubund = Ubound(sArry)
If ubund >= 0Then
For inx = 0 To ubund
Do
sStr = sArry(inx)
sMid = sMid & Mid(sStr , cnt , 1)
cnt = cnt+1
Loop While (sStr <> sMid)
Temp = cnt - 1
sum = sum+ Temp
cnt = 1
sMid = Empty
If inx > ubund Then
Exit For
End If
Next
Totlenofstr = sum+
ubund
MsgBox "The Length Of string without using the inbuilt function
Len(Str):" & Totlenofstr
End If
End Function
' To check whether the length of string is correct or wrong use the
Inbuilt function Len
Msgbox " The Length of the given string using Inbuilt function Len(Str) :
" & Len(Str)
On Fri, Nov 15, 2013 at 11:32 PM, shikhar khandare
<[email protected]>wrote:
> Amit's answer seems to be the most apt one/
>
> On Saturday, 26 March 2011 14:23:32 UTC+5:30, Suresh Bhandari wrote:
>>
>> Hi,
>>
>> Can anybody tell, how to find length of String *without using InBuild
>> Function*.
>>
>>
>> Thanks,
>> Suresh Bhandari
>> Mob - 9052999540
>>
> --
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "QTP - HP Quick Test Professional - Automated Software Testing" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.