Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 892
  • Last Modified:

Strip string after a specific character in VB.net

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
nkewney
Asked:
nkewney
1 Solution
 
Wayne Taylor (webtubbs)Commented:
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
 
nkewneyAuthor Commented:
Great, thanks :)
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now