GetStringPart

Public Function GetStringPart(ByRef InputString As String, Optional ByVal SepChar As String = ";", Optional ByVal CompareBinary As Boolean = False) As String

The GetStringPart function 'eats' a part of the given pInputString until the given separation character (or separation string). The part until the separation character is returned as return value, if the pInputString was passed 'ByRef', it now contains the part after the found separation character.

If the separation character is not found, the whole string is returned and the pInputString is cleared.

Dim lString = "This is a demo"
SendDebug GetStringPart(lString, " ") 'Prints 'This', lString = 'is a demo'
SendDebug GetStringPart(lString, " ") 'Prints 'is', lString = 'a demo'
SendDebug GetStringPart(lString, " ") 'Prints 'a', lString = 'demo'
SendDebug GetStringPart(lString, " ") 'Prints 'demo', lString = ''
SendDebug GetStringPart(lString, " ") 'Prints nothing

See also: