Solved

Strip string after a specific character in VB.net

Posted on 2008-10-18
2
838 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
[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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

718 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