C Type Library

The mikroBasic PRO for dsPIC30/33 and PIC24 provides a set of library functions for testing and mapping characters.

Library Functions

isalnum

Prototype

sub function isalnum(dim character as byte) as byte

Description

Function returns 0xFF if the character is alphanumeric (A-Z, a-z, 0-9), otherwise returns zero.

Example
res = isalnum("o")   ' returns 0xFF
res = isalnum("\r")  ' returns 0

isalpha

Prototype

sub function isalpha(dim character as byte) as word

Description

Function returns 0xFF if the character is alphabetic (A-Z, a-z), otherwise returns zero.

Example
res = isalpha("A")  ' returns 0xFF
res = isalpha("1")  ' returns 0

iscntrl

Prototype

sub function iscntrl(dim character as byte) as word

Description

Function returns 0xFF if the character is a control or delete character(decimal 0-31 and 127), otherwise returns zero.

Example
res = iscntrl("\r")  ' returns 0xFF
res = iscntrl("o")   ' returns 0

isdigit

Prototype

sub function isdigit(dim character as byte) as word

Description

Function returns 0xFF if the character is a digit (0-9), otherwise returns zero.

Example
res = isdigit("1")  ' returns 0xFF
res = isdigit("o")  ' returns 0

isgraph

Prototype

sub function isgraph(dim character as byte) as word

Description

Function returns 0xFF if the character is a printable, excluding the space (decimal 32), otherwise returns zero.

Example
res = isgraph("o")  ' returns 0xFF
res = isgraph(" ")  ' returns 0

islower

Prototype

sub function islower(dim character as byte) as word

Description

Function returns 0xFF if the character is a lowercase letter (a-z), otherwise returns zero.

Example
res = islower("0")  ' returns 0xFF
res = islower("A")  ' returns 0

ispunct

Prototype

sub function ispunct(dim character as byte) as word

Description

Function returns 0xFF if the character is a punctuation (decimal 32-47, 58-63, 91-96, 123-126), otherwise returns zero.

Example
res = ispunct(".")  ' returns 0xFF
res = ispunct("1")  ' returns 0

isspace

Prototype

sub function isspace(dim character as byte) as word

Description

Function returns 0xFF if the character is a white space (space, tab, CR, HT, VT, NL, FF), otherwise returns zero.

Example
res = isspace(" ")  ' returns 0xFF
res = isspace("1")  ' returns 0

isupper

Prototype

sub function isupper(dim character as byte) as word

Description

Function returns 0xFF if the character is an uppercase letter (A-Z), otherwise returns zero.

Example
res = isupper("A")  ' returns 0xFF
res = isupper("a")  ' returns 0

isxdigit

Prototype

sub function isxdigit(dim character as byte) as word/p>

Description

Function returns 0xFF if the character is a hex digit (0-9, A-F, a-f), otherwise returns zero.

Example
res = isxdigit("A")  ' returns 0xFF
res = isxdigit("P")  ' returns 0

toupper

Prototype

sub function toupper(dim character as byte) as byte

Description

If the character is a lowercase letter (a-z), the function returns an uppercase letter. Otherwise, the function returns an unchanged input parameter.

Example
res = toupper("a")  ' returns A
res = toupper("B")  ' returns B

tolower

Prototype

sub function tolower(dim character as byte) as byte

Description

If the character is an uppercase letter (A-Z), function returns a lowercase letter. Otherwise, function returns an unchanged input parameter.

Example
res = tolower("A")  ' returns a
res = tolower("b")  ' returns b
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code