Charater Classification and Conversion

Reference Section

_is_instr
_to_lower
_to_upper

_is_instr


Descrip
Determines if a character matches any character from a given string.

Syntax
#include <charconv.h>
int _is_instr(int chr, char *string);

Returns
1 if chr matches a character in string (terminating NULL excluded).

0 if chr does not match a character in string.

Notes
This function compares chr with each successive character in string until either a match or the end of string is reached. 1 is returned if a character matching chr is found in the string. 0 is returned if no matching character is found.

C/C++ Example
	{
	   char chr = _to_upper (_get_chr());
	   if (chr == 0)
	      _get_chr ();/* get extended chars also */
	   else
	   {
	      if (!_is_instr (chr, "ABCD"))
	      {
	         _put_str ("Invalid selection\n\r");
	      }
	      else
	      {
	         /* process the keystroke */
	      }
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char string[] = "beam me up...!";
	   ...
	   lea si,string
	   get_chr ();	/* AL = chr */
	   is_instr ();	/* is chr in string? */
	    je instr_020/*   y: handle the keystroke */
	   _put_str ("Invalid selection");
	   	  	 	/*   n: give message and exit */
	   put_newline ();
	   jmp instr_040

	instr_020:
	   /* Handle the keystroke */
	instr_040:
	   ...
	}

Source file _CHISINS.ASM ASM equiv IS_INSTR

_to_lower


Descrip
Converts an uppercase ASCII letter (A-Z) to lowercase (a-z).

Syntax
#include <charconv.h>
char _to_lower(int chr);
Returns
The lowercase equivalent of chr.

Notes
This function converts chr from ASCII uppercase (A-Z) to lowercase (a-z). chr is not converted unless it is an ASCII uppercase letter.

C/C++ Example
	{
	   char chr = _get_chr ();
	   if (chr == 0)
	   _get_chr ();	 /* get extended chars also */
	   chr = _to_lower (chr); /* Process the lowercase keystroke */
	}

Inline Assembly Example
	#include <inline.h>
	   ... 
	   get_chr ();	/* AL = character*/
	   to_lower ();	/* AL = converted chr*/
	   	  	 	/* Handle the keystroke */
	   ...

Source file _CHTOLWR.ASM ASM equiv TO_LOWER
See also
_to_upper

_to_upper


Descrip
Converts a lowercase ASCII letter (a-z) to uppercase (A-Z).

Syntax
#include <charconv.h>
char _to_upper(int chr);

Returns
The uppercase equivalent of chr.

Notes
This function converts chr from ASCII lowercase (a-z) to uppercase (A-Z). chr is not converted unless it is an ASCII lowercase letter.

C/C++ Example
	{
	   char chr = _get_chr ();
	   if (chr == 0)
	   _get_chr ();	 /* get extended chars also */
	   chr = _to_upper (chr); /* Process the uppercase keystroke */
	}   

Inline Assembly Example
	#include <inline.h>

	   get_chr ();	/* AL = character*/
	   to_upper ();	/* AL = converted chr*/
	   	  	 	/* Handle the keystroke */

Source file _CHTOUPR.ASM ASM equiv TO_UPPER
See also
_to_lower