Chartest#

a group of routines which perform various functions and tests on characters.

General Information

Author: OSS,Inc
Language: ACTION!
Compiler/Interpreter: ACTION!
Published: 1984

;												
;
;CHARTEST.ACT - a group of routines
;which perform various functions and
;tests on characters.
;
;	Copyright (c) 1984 by OSS,Inc.
;												

;************************************
;Test if 'c' is alphabetic
;************************************

BYTE FUNC IsAlpha(BYTE c)

  IF ((c>='A) AND (c<='Z)) OR
		 ((c>='a) AND (c<='z)) THEN
	 RETURN(1)
  FI
RETURN(0)

;************************************
;Test if 'c' is uppercase alphabetic
;************************************

BYTE FUNC IsUpper(BYTE c)

  IF (c>='A) AND (c<='Z) THEN
	 RETURN(1)
  FI
RETURN(0)

;************************************
;Test if 'c' is lowercase alphabetic
;************************************

BYTE FUNC IsLower(BYTE c)

  IF (c>='a) AND (c<='z) THEN
	 RETURN(1)
  FI
RETURN(0)

;************************************
;Test if 'c' is a digit (0-9)
;************************************

BYTE FUNC IsDigit(BYTE c)

  IF (c>='0) AND (c<='9) THEN
	 RETURN(1)
  FI
RETURN(0)

;************************************
;Change 'c' to uppercase if necessary
;************************************

BYTE FUNC ToUpper(BYTE c)

  IF IsLower(c) THEN
	 c==-$20
  FI
RETURN(c)

;************************************
;Change 'c' to lowercase if necessary
;************************************

BYTE FUNC ToLower(BYTE c)

  IF IsUpper(c) THEN
	 c==+$20
  FI
RETURN(c)

; End of CHARTEST.ACT 

MODULE