• Log in or sign up for an account here: https://www.sythe.org/login

[Source] GetBetween without Regex

Blupig

BEEF TOILET

$5 USD Donor
Joined
Nov 23, 2006
Sythe Gold
1,609
Messages
7,145
Age
33
Location
Canada
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
Recently for my C++ classes and during highschool for when I made my Java scriptable bot, I've had to make GetBetween functions to easily get between two strings from a source point. I've been using one I found online VB for quite some time, but realized that it can be done in a far more simple way:

Code:
    Private Function GetBetween(ByVal Source As String, ByVal Start As String, ByVal Finish As String) As String

        Dim index As Integer = InStr(Source, Start) + (Start.Length - 1)
        Dim fIndex As Integer = InStr(Source, Finish) - 1
        Dim len As Integer = fIndex - index

        Return Source.Substring(index, len)

    End Function

Gets the string between Start and Finish from the text Source.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
how fast is it compared with regex? will it create lag/slow program?

Nope. You might experience like a couple ms of lag but it's not hard to make a function like this asynchronous.
 
Runescape Gamblingrunescape gambling
Back
Top