Solved

how to find the end of the string occurance

Posted on 2007-11-23
4
192 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
  • 2
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
good enough.  Thanks Angell.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now