msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VB6 Compare

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax
Author Message
ceal21c



Joined: 04 Oct 2007
Posts: 1

PostPosted: Mon May 22, 2006 5:50 pm    Post subject: VB6 Compare Reply with quote

Hey Guys,

I have two strings strFullName (Bobby John)and strFirstName (Bobby). I
need to search strFullName for the existance of strFirstName. When I
try to use the following code I never get a match because the two
strings are not identical; Answer = StrComp(strFirstName, strFullName).
Is there a way to perform a partial search for the existance of "Bobby"
within "Bobby John"?



--
ceal21c
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Archived from group: microsoft>public>vb>syntax
Back to top
View user's profile Send private message
Karl E. Peterson



Joined: 04 Oct 2007
Posts: 4836

PostPosted: Mon May 22, 2006 10:23 pm    Post subject: Re: VB6 Compare Reply with quote

ceal21c wrote:
> I have two strings strFullName (Bobby John)and strFirstName (Bobby).
> I need to search strFullName for the existance of strFirstName. When
> I try to use the following code I never get a match because the two
> strings are not identical; Answer = StrComp(strFirstName,
> strFullName). Is there a way to perform a partial search for the
> existance of "Bobby" within "Bobby John"?

Take a look at the Instr function. One potential method:

If Instr(1, strFullName, strFirstName, vbTextCompare) Then
' yep, got a match...

Later... Karl
--
Working without a .NET?
http://classicvb.org/

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group