FUNCTIONS CORE

IsPunct()

Check if the first character of a string is a punctuation character

Syntax

Signature
IsPunct( cString ) --> lIsPunctuationChar

Arguments

cString

Example

IsPunct.prg
PROCEDURE Main()

   LOCAL cPunct := ""
   LOCAL i

   FOR i := 32 TO 126
      IF IsPunct( Chr( i ) )
         cPunct += Chr( i )
      ENDIF
   NEXT

   Check( 'Len( cPunct )   ', Len( cPunct ), 32 )
   Check( 'IsPunct( "," )  ', IsPunct( "," ), .T. )
   Check( 'IsPunct( "a" )  ', IsPunct( "a" ), .F. )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

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

RETURN

Output

Len( cPunct )   OK
IsPunct( "," )  OK
IsPunct( "a" )  OK