Finding a string anywhere within another string

Posted on 2006-03-29
Medium Priority
Last Modified: 2010-04-23
Dim str as string


Str = “06/21 First Choice”


What code do I use to find out if “First Choice” exists in str? (It won't always be in that position)



Question by:supportlaselledu
1 Comment
LVL 34

Accepted Solution

flavo earned 200 total points
ID: 16325619
How 'bout this?

Use the String.IndexOf method

        Dim s As String = "06/21 First Choice"
        Dim sFind As String = "First Choice"
        MessageBox.Show(Me, CBool(s.IndexOf(sFind)))


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question