CRT Character Functions

This program demonstrates some of the CRT character functions.

'CRT Character Functions
'Demonstrates some of the CRT character functions.
'**************************************************

#include once "crt.bi"

Dim As String myString
Dim As Integer ret, i, ichar

'Load some characters into the string
myString = "ABcd01!*  " & Chr(128) & Chr(1)

'Print header on console
Print "Char";Tab(6);"Alnum";Tab(12);"Alpha";Tab(18);"Cntrl";Tab(24);
Print "Digit";Tab(30);"Graph";Tab(36);"Lower";Tab(42);"Print";Tab(48);
Print "Punct";Tab(54);"Space";Tab(60);"Upper"
Print String(79, "-")

'Examine each character in string.
For i = 1 To Len(myString)
    ichar = Asc(Mid(myString, i, 1))
    'Print the character
    Print Chr(ichar);
    Print Tab(6);
    'Check to see what kind of character it is
    ret = isalnum(ichar)
    'If character type then print Y
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(12);
    ret = isalpha(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(18);
    ret = iscntrl(ichar)
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(24);
    ret = isdigit(ichar)
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(30);
    ret = isgraph(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(36);
    ret = islower(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(42);
    ret = isprint(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(48);
    ret = ispunct(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(54);
    ret = isspace(ichar) 
    If ret <> 0 Then
        Print "Y";
    Else
        Print "N";
    End If
    Print Tab(60);
    ret = isupper(ichar)
    If ret <> 0 Then
        Print "Y"
    Else
        Print "N"
    End If
Next

Sleep
End