Domino Code Fragment

Code Name*
Function String Explode
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.14.142.115
Description*
This function takes a string and converts it to an array, based on a delimiter
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Function STRExplode( Byval strValue As String, strDelimiter As String, bBlanks As Variant) As Variant
'** This function takes a string and converts it to an array, based on a delimiter

'** Parameters:
'**strValue- the string to explode
'**strDelimiter- the delimiter
'**bBlanks- a boolean value, pass true to have blanks placed in array when two delimiters have nothing between them
'**pass false to ignore the blanks

Dim strTemp As String
Dim strValues() As String
Dim iPlace As Integer
Dim idelimLen As Integer
Dim iValueCount As Integer

idelimLen = Len( strDelimiter)

iPlace = Instr( strValue, strDelimiter)

Do While iPlace <> 0

If (iPlace <> 1 Or bBlanks) Then
Redim Preserve strValues(iValueCount) As String
strValues(iValueCount) = Left( strValue, iPlace - 1)
iValueCount = iValueCount + 1
End If

strValue = Right( strValue, Len( strValue) - iPlace - idelimLen + 1)

iPlace = Instr( strValue, strDelimiter)

Loop

If Len( strValue ) <> 0 Or bBlanks Then
Redim Preserve strValues(iValueCount) As String

strValues(iValueCount) = strValue
Elseif iValueCount = 0 Then
Redim Preserve strValues(iValueCount) As String
End If

STRExplode = strValues

End Function