VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



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

by Roni Tovi (4 Submissions)
Category: Coding Standards
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

It simply tokenizes the string by a specified separator.

Assumes
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 :)

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

'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

Download this snippet    Add to My Saved Code

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

No comments have been posted about GetTok How to tokenize a string ? (Like $gettok() in mIRC Scripting). Why not be the first to post a comment about GetTok How to tokenize a string ? (Like $gettok() in mIRC Scripting).

Post your comment

Subject:
Message:
0/1000 characters