Solved

how to find the end of the string occurance

Posted on 2007-11-23
4
205 Views
Last Modified: 2010-04-23
I can find the beginnning of the string occurance with the indexof function.  How do I find the end of the string occurance?

       If localUnParsedAddress.Contains(" Drive ") Then
           'This gives me the beginning of the string occurance.  Need the end
            x = localUnParsedAddress.IndexOf(" Drive ")
            EndOfOccurance = ???
       End If
0
Comment
Question by:dchau12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 20340991
you mean, the end of the string you are looking for?

 Dim search_for as string = " Drive "

If localUnParsedAddress.Contains(search_for) Then
           'This gives me the beginning of the string occurance.  Need the end
            x = localUnParsedAddress.IndexOf(search_for)
            EndOfOccurance = x + search_for.Length
       End If
0
 

Author Comment

by:dchau12
ID: 20341020
That works if I know that drive is what I am searching for.   I need to search for a lot of different string though.  How would you programatically do something like this?

If localUnParsedAddress.Contains(" Drive ") or localUnParsedAddress.Contains(" Lane ") or localUnParsedAddress.Contains(" Street ") Then
           'This gives me the beginning of the string occurance.  Need the end
            x = localUnParsedAddress.IndexOf(" Whatever string it contains ")
            EndOfOccurance = ???
       End If

0
 

Author Comment

by:dchau12
ID: 20341151
good enough.  Thanks Angell.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20341946
>I need to search for a lot of different string though.
you can put the searchable items into an array, and loop the array...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 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