Quality Testing

Quality is delighting customers

Program to compare two strings using "instr" function using VB Script?

write a program to

compare 2 strings using 'instr' function using vb script

Views: 5109

Reply to This

Replies to This Discussion

thanks for everyone for ur suggitions.

one of friend send this program also

a=InputBox("enter a value")
b=InputBox("enter b value")
If Len(a)=Len(b) Then
If InStr(1,a,b,0)=1 Then
MsgBox "equal"
Else
MsgBox "not equal"
End if
Else
MsgBox "not equal length"
End if

vipin thanks for ur suggition but

enter str1="siva" str2="Siva"

then instr(1,str1,str2,0)=instr(1,str2,str1,0) then 

it shows true 

but actually false

Siva the program i have send will saw u this as false.

It will track the case comparision for the string we are comparing.

that is not my script.

check this 

a=InputBox("enter a value")
b=InputBox("enter b value")
If Len(a)=Len(b) Then
If InStr(1,a,b,0)=1 Then
MsgBox "equal"
Else 
MsgBox "not equal"
End if
Else
MsgBox "not equal length"
End if

    Hi siva,we can also compare using strcomp function

   x1=strcomp("Quality","Quality")

  msgbox x1

[If the strings are same the output is zero,if not the output will be 1 or -1]

if strcomp use , then what is the use of this  discussion  

 siva,i am just telling the other way to compare strings....

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service