Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to find the end of the string occurance

Posted on 2007-11-23
4
Medium Priority
?
208 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 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