Getting text between text :o

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Getting text between text :o
CodenBoy
Lool, the title is weird ik :D
Just asking how can i get the text like this:

If i had a textbox or richtextbox with this text
Code: Select all
@!@Party!@!@
I want to get the "party!" text how i do it? i mean i wanna get any text inside the @!@ and @1@ < :D

hope u understand my EnGlish xD idoit;
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Getting text between text :o
mandai
You can use this:
Code: Select all
    Private Sub btnTest_Click(sender As System.Object, e As System.EventArgs) Handles btnTest.Click

        Dim input As String = "@!@Party!@!@"

        Dim separator As String = "@!@"

        Dim starting As Integer = input.IndexOf(separator) + separator.Length

        Dim finishing As Integer = input.LastIndexOf(separator) - separator.Length

        Dim result As String = input.Substring(starting, finishing)

        MsgBox(result)

    End Sub
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Re: Getting text between text :o
CodenBoy
Thanks mandai will try it and say, thanks loove;
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

Re: Getting text between text :o
CodenBoy
It worked great, thanks
4 posts Page 1 of 1
Return to “Coding Help & Support”