Solved

Strip string after a specific character in VB.net

Posted on 2008-10-18
2
823 Views
Last Modified: 2010-04-21
Dear Experts,

How can I extract the text 'The cat sat on the>' from the string:

string = "The cat sat on the>mat"

I want to strip out everything after the '>' character (escape character in my script)

Any help would be appreciated,

Thanks

Nick
0
Comment
Question by:nkewney
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 22747655
Use the String.SubString and String.indexOf methods....

    Dim s As String = "The cat sat on the>mat"
    Dim NewStr As String = s.Substring(0, s.IndexOf(">") + 1)

Wayne
0
 
LVL 1

Author Closing Comment

by:nkewney
ID: 31507393
Great, thanks :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

12 Experts available now in Live!

Get 1:1 Help Now