Manage Learn to apply best practices and optimize your operations.

# Split String

## Domino Resources - Part 4

### Looking for something else?

The sub Click is the example call, tokStrInArray and strTok\$ are the
implementation.
Sub Click(Source As Button)
Dim ArrayList\$(), i
tokStrInArray ArrayList\$(), "One;Two;Three", ";"
For i = Lbound(ArrayList\$) To Ubound(ArrayList\$)
Msgbox ArrayList\$(i)
Next i
End Sub

Sub tokStrInArray (Array\$(), st\$, Delimiters\$)

Dim i As Integer, j As Integer, Token\$
ReDim tmp\$(640) ' temporary array

' Invoke StrTok\$ with the string to tokenize.
Token\$ = strTok\$(st\$, Delimiters\$)
i = 0
Do While Token\$ <> ""
' Transfer to temporary array
i = i + 1
tmp\$(i) = Token\$
' Call StrTok\$ with a null string so it knows this
' isn't the first call.
Token\$ = strTok\$("", Delimiters\$)
If i >= 640 Then Exit Do
Loop

' Redimension CLArgs\$() and transfer values from tmp\$()
ReDim Array\$(1 To i)
For j = 1 To i
Array\$(j) = tmp\$(j)
Next j

End Sub

Function strTok\$ (Srce\$, Delim\$)

Dim BegPos%, EndPos%, Ln%
Static start%, SaveStr\$

' If first call, make a copy of the string.
If Srce\$ <> "" Then
start% = 1: SaveStr\$ = Srce\$
End If

BegPos% = start%: Ln% = Len(SaveStr\$)
' Look for start of a token (character that isn't delimiter).
While BegPos% <= Ln% And InStr(Delim\$, Mid\$(SaveStr\$, BegPos%, 1)) <> 0
BegPos% = BegPos% + 1
Wend
' Test for token start found.
If BegPos% > Ln% Then
strTok\$ = "": Exit Function
End If
' Find the end of the token.
EndPos% = BegPos%
While EndPos% <= Ln% And InStr(Delim\$, Mid\$(SaveStr\$, EndPos%, 1)) = 0
EndPos% = EndPos% + 1
Wend
strTok\$ = Mid\$(SaveStr\$, BegPos%, EndPos% - BegPos%)
' Set starting point for search for next token.
start% = EndPos%

End Function
This was last published in November 2000

#### Start the conversation

Send me notifications when other members comment.

## SearchWindowsServer

• ### Creating PowerShell scripts for task automation

At a certain point, administrators who run PowerShell commands from the console will find it more efficient to develop a script ...

• ### Windows Defender Credential Guard secures login data

Windows Defender Credential Guard uses virtualization to isolate access to domain credentials and diminish the threat of attacks ...

March Patch Tuesday adds several more mitigations for the Spectre and Meltdown exploits, this time for 32-bit server and client ...

## Search400

• ### iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• ### V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• ### Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

## SearchDataCenter

• ### IBM Cloud services to secure mainframes out to the edge

Big Blue will introduce IBM Cloud services that use blockchain, containers and its z14 mainframes to deliver improved security ...

• ### Four disadvantages of hyper-converged infrastructure systems

Problems with scalability and unexpected licensing costs can create problems for organizations that deploy hyper-converged ...

• ### IBM Power9 servers seek market inroads to AI, cloud

IBM follows up its first Power9 server with a raft of systems designed to appeal to a wider array of markets -- most notably, AI ...

## SearchExchange

• ### Using Microsoft Exchange certificates requires planning

Exchange certificates typically require minimal management effort after they have been set up, and they offer a secure means of ...

• ### Office 365 email encryption options grow for enterprise needs

Each enterprise has different needs when it comes to preventing data leakage. Admins should be aware of the Office 365 mailbox ...

Everyone wants a smooth patching process, but things can fall apart despite everyone's best efforts. Develop a solid recovery ...

## SearchContentManagement

• ### Scrivito unveils serverless CMS product

By building the CMS with ReactJS, Scrivito gained attraction with development community, according to an analyst.

• ### Content personalization tools sharpen focus on customers

Content personalization isn't new; Amazon weaponized it, and Jeff Bezos is the world's richest man. New tools are putting it ...

• ### Leading brands see the need for personalized content

Content personalization continues to expand within companies as maturing technologies make it a viable marketing option for ...

Close