TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: PIETER DE RUITER
date: 1997-12-15 06:29:00
subject: GetToken() Bug??

From: Pieter de Ruiter 
Hi,
Using GetToken() in SAL (TSE 2.5) I detected a unexpected effect.
Can anybody explain the output of this test-macro? 
In my opinion the output of each mTestToken() call should be equal (as the
first call)! 
The GetToken() function seem to treat a non-blank character different from a
blank.
Can't figure out what I'm doing wrong...
----------------------------------------------------------------------------
------------------
proc mTestToken(string sSearch, string sDelim)
    integer i, nNum = NumTokens(sSearch,sDelim )
    addline("Number of tokens: " + str(nNum))
    for i=1 to nNum
        addline(str(i) + " " + GetToken(sSearch, sDelim,i))
    endfor
end
proc mTest()
    mTestToken("How many    tokens?", " ;")
    mTestToken("How many;;;;tokens?", " ;")
    mTestToken("How many ;  tokens?", " ;")
end
             mTest()
----------------------------------------------------------------------------
------------------
Output:
-------
Number of tokens: 3
1 How
2 many
3 tokens?
Number of tokens: 6
1 How
2 many
3
4
5
6 tokens?
Number of tokens: 5
1 How
2 many
3
4
5 tokens?
----------------------------------------------------------------------------
------------------
Thanks
Pieter de Ruiter,
Utrecht, Nederland
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.