Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2004, 02:03 PM
Authorized User
 
Join Date: Jun 2003
Location: Marikina, , Philippines.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rylemer Send a message via MSN to rylemer Send a message via Yahoo to rylemer
Default search string either Upper case or lower case

Is there a function can I use for this type of problem

First, I have to search for a particular string.

   sComp = "Company list, The"

I want to search for a string ", The"

I used
   nPos = InStr(sComp , ", The")

My question is, sometimes the sComp = "Company list, THE"
and sComp = "Company list, ThE"


Thanks,
Elmer
 
Old March 24th, 2004, 02:25 PM
Authorized User
 
Join Date: Jun 2003
Location: , Quebec, Canada.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Make a compare using vbTextCompare. It will search the string ignoring the case.

nPos = InStr(sComp , ", the", vbTextCompare)

St├ęphane Lajoie
 
Old March 24th, 2004, 04:15 PM
Authorized User
 
Join Date: Jun 2003
Location: Marikina, , Philippines.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rylemer Send a message via MSN to rylemer Send a message via Yahoo to rylemer
Default

Thanks it works St├ęphane Lajoie

what if my sComp = "33 Anywhere st. Nowhere Ave."
               and "33 Anywhere Street. Nowhere Avenue"

what should be my search string to get both the sComp

nPos2 = InStr(1, sLine, "?", vbTextCompare)

Thanks,
Elmer
 
Old March 24th, 2004, 04:23 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi..

then you will have to use something like this..

if scomp like "33 Anywhere st*. Nowhere Ave" then

b/c you are not interested in the case, add lcase() to both strings...

HTH

Gonzalo




Similar Threads
Thread Thread Starter Forum Replies Last Post
lower case kgoldvas XSLT 3 February 28th, 2007 07:43 AM
how to make lower case in dataformatstring hardik Classic ASP Databases 1 February 14th, 2006 05:45 AM
first character as Upper Case crmpicco VB How-To 4 July 1st, 2005 01:35 PM
check for lower case (LCase)? crmpicco Excel VBA 2 May 12th, 2005 03:42 PM
Checking for upper,lower case, number and symbol dumbdumb SQL Server 2000 1 March 18th, 2004 03:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.