Search Tools Links Login

GetTok - How to tokenize a string ? (Like $gettok() in mIRC Scripting)


It simply tokenizes the string by a specified separator.

Original Author: Roni Tovi

Assumptions

Like $gettok identifier in mIRC. Easy to understand and use. Please vote for my code because this is my first code on planet-soruce-code.com :)

Code

'Paste it into a module and call from anywhere!
Public Function GetTok(strString As String, N As Integer, strSep As String)
On Error Resume Next
Dim GArray
GArray = Split(strString, strSep)
If N = 0 Then
'if you specify 0 as N, then the function returns how much tokens exists in your string
GetTok = UBound(GArray) + 1
Exit Function
End If
GetTok = GArray(n - 1)
End Function

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 99 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.