titlebar.gif (10031 bytes)toolbar.gif (3802 bytes)box.gif (3888 bytes)

'*************************************************************************************************
'* This source code is the work of Chris Miles and is an active part of Xirc and my purpose of
'* posting it is to help out other people developing an IRC client!
'*************************************************************************************************
'* This is a great peice of code for getting tokens from a peice of data ,
‘* 
'* this is widly used in Xirc and will be needed for most of the code posted here!
'**************************************************************************************************
'************ Put this function in a module ***********

Public Function GetToken(ByVal TokenString As String, ByVal Separator As String, ByVal Token As Long) As String
  Separator = Left$(Separator, 1)
  Dim iLastPos As Long: iLastPos = 1
  Dim iTok As Long: iTok = Abs(Token)
  Dim iPos As Long
  Dim iCount As Long
  Dim sOriginal As String: sOriginal = TokenString

If Left$(TokenString, 1) <> Separator Then TokenString = Separator & TokenString
If Right$(TokenString, 1) <> Separator Then TokenString = TokenString & Separator
Do
    iCount = iCount + 1
     iPos = InStr(iLastPos, TokenString, Separator)
If iPos = 0 Then Exit Do
    If iCount = iTok Then
     If iTok = Token Then
     GetToken = Mid$(TokenString, iPos + 1)
     GetToken = Mid$(GetToken, 1, InStr(1, GetToken, Separator) - 1)
    Else
  GetToken = Strip(Mid$(TokenString, iPos + 1), Separator, "-1") & IIf(Right$(sOriginal, 1) = Separator,          Separator, "")
   End If
   Exit Function
  End If
   iLastPos = iPos + 1
   Loop
End Function

'************ Put this function in a module  ^^^^^^ up ***********


This site is maintained by Chris Miles [email protected] all work is copyright 1999 Chris Miles Visual Software

This site was last updated on
This page was written in HTML and