Go Back   Gaming Gutter > Non-Gaming > Programming > Source Code


Source Code - Have a source code/project files you want to post? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» GG Stuff

Follow us on Twitter!

Get the GG toolbar today (for firefox only)
» Recent Threads
Go to first new post If you could be the...
Today 03:57 AM
by Charger
Last post by Charger
Today 04:18 AM
2 Replies, 12 Views
Go to first new post Post Your Picture (Read...
10-10-2006 12:34 AM
by Ryan
Last post by Fran
Today 04:12 AM
13,111 Replies, 221,438 Views
Go to first new post Does it make a guy gay...
03-22-2009 01:32 PM
Last post by Charger
Today 04:11 AM
263 Replies, 7,787 Views
Go to first new post Do Parents Have The...
11-18-2009 10:07 PM
by dsi
Last post by Charger
Today 03:49 AM
2 Replies, 23 Views
Go to first new post Gay for Pay?
09-03-2009 02:30 PM
by Gloomy
Last post by Charger
Today 03:42 AM
27 Replies, 298 Views
Reply
 
LinkBack Thread Tools Display Modes

 [VB.NET] GetBetween and GetBetweenAll
Old 10-07-2009, 05:35 AM   #1 (permalink)
Banned

Male Backslash is offline
 
Join Date: Oct 2009
Posts: 172
GPoints: 1,892
iTrader: 3 / 100%
Backslash Is Popular
Rep Power: 0
[VB.NET] GetBetween and GetBetweenAll

[VB.NET] GetBetween and GetBetweenAll

GetBetween
Code:
Public Function GetBetween(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, _
                            Optional ByRef startPos As Integer = 0) As String
        Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
        Dim strResult As String

        strResult = String.Empty
        iPos = strSource.IndexOf(strStart, startPos)
        iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
        If iPos <> -1 AndAlso iEnd <> -1 Then
            strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
        End If
        Return strResult
    End Function
Getbetween parases a string between 2 strings in a source.

GetBetweenAll
Code:
Public Function GBA(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, ByVal lstAdd As ListBox, Optional ByRef startPos As Integer = 0) As String
        Dim iPos As Integer, iEnd As Integer, strResult As String, lenStart As Integer = strStart.Length

        Do Until iPos = -1
            strResult = String.Empty
            iPos = strSource.IndexOf(strStart, startPos)
            iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
            If iPos <> -1 AndAlso iEnd <> -1 Then
                strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
                lstAdd.Items.Add(strResult)
                startPos = iPos + lenStart
            End If
        Loop

        GBA = ""
    End Function
Getbetweenall parses all the strings in the source that is between 2 strings.

Last edited by Backslash; 10-09-2009 at 06:00 PM..
  Reply With Quote
The Following User Says Thank You to Backslash For This Useful Post:
mehike (10-10-2009)

 
Old 10-10-2009, 04:37 PM   #2 (permalink)
Underground

Male mehike is offline
 
mehike's Avatar
 
Join Date: Jul 2007
Location: Tallinn
Age: 19
Posts: 298
GPoints: 3,469
iTrader: 7 / 100%
mehike Is Amongst Royaltymehike Is Amongst Royalty
Rep Power: 9
There are many different variants of these functions going around, but nice job!
__________________
"Reality is merely an illusion, albeit a very persistent one."
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBadvanced CMPS v3.1.0

All times are GMT -7. The time now is 04:30 AM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.11700296 seconds (100.00% PHP - 0% MySQL) with 21 queries