FUNCTIONS CORE

GetPairLen()

Return the length of a color value within a color string

Syntax

Signature
GetPairLen( cColorString, nPos ) --> nLength

Arguments

cColorString

nPos

Example

GetPairLen.prg
PROCEDURE Main()

   LOCAL cColors := "W/N,N/W,W+/B"

   Check( 'GetPairLen( cColors, 1 ) ', GetPairLen( cColors, 1 ), 3 )
   Check( 'GetPairLen( cColors, 3 ) ', GetPairLen( cColors, 3 ), 4 )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

GetPairLen( cColors, 1 ) OK
GetPairLen( cColors, 3 ) OK