Inaccuracy in the description of the function DC_TokenNum

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Inaccuracy in the description of the function DC_TokenNum

#1 Post by Eugene Lutsenko »

Yet I could not get to function DC_TokenNum( Fv ) worked with all separators provided by default. Have to write it in the form: DC_TokenNum( Fv ," " ), which is undesirable because there are other delimiters.

Can be used:
cDelims = " Š,.;:!?/()#&%+-*"+CHR(0)+CHR(9)+CHR(10)+CHR(13)+CHR(26)
DC_TokenNum( Fv , cDelims )

What is the difference function DC_TokenNum and DC_Token of unparalleled NumToken and Token?

The function is called DC_TokeNum (), and in the Examples herein words DK_NUMTOKEN() that is not in the dll:


Syntax:

DC_TokenNum ( <cString>, ;
[<cDelims>] ) -> nTokens


Arguments:

<cString> is a character string containing tokens.

<cDelims> is a character string containing the delimeter(s)
to use between tokens. If no parameter is passed then the
following default set of delimeters will be used:

<SPACE>
Š,.;:!?/()#&%+-*
<CHR(0)>
<CHR(9)>
<CHR(10)>
<CHR(13)>
<CHR(26)>

Returns:

A numeric value.


Description:

DC_TOKENNUM() is used to determine the number of tokens
that exist in a character string.

Tokens are sub-strings within a string that are separated
by common delimiters.


Examples:

cString := 'This is a test'
? DC_Token( cString,,2 )
is
? DC_NUMTOKEN( cString )
4

cString := 'AB|CD|EF|GHI|JKLM|NOP|QR|STUVW|XYZ'
? DC_Token( cString,'|',5 )
JKLM
? DC_NUMTOKEN( cString )
9


Source/Library:

_DCTOKEN.PRG/.OBJ, DCLIPX.LIB

See Also:

dc_token(), dc_tokenarray()

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Inaccuracy in the description of the function DC_TokenNu

#2 Post by rdonnay »

Eugene -

I may not have kept up with DC_TokenNum() over the years because I never use it.

I always call DC_TokenArray() which returns an array of tokens.
This is a workaround for you.

nTokens := Len(DC_TokenArray(cString))

Roger
The eXpress train is coming - and it has more cars.


Post Reply