Module character-type

This module contains a set of methods for testing various properties of <character> this will work 100% correctly only with ASCII English characters. Fixing this so it handles Unicode better would be a good way of covering yourself with glory, hint hint.


alphabetic?[Function]

Returns #t if the character is in [a-zA-Z].

Synopsis

alphabetic? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is alphabetic, #f otherwise.

digit?[Function]

Returns #t if the character is a numeric digit [0-9].

Synopsis

digit? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a digit, #f otherwise.

alphanumeric?[Function]

Returns #t if the character is alphabetic or a digit.

Synopsis

alphanumeric? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is alphanumeric, #f otherwise.

whitespace?[Function]

Returns #t if the character is whitespace.

Synopsis

whitespace? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is whitespace (space, tab, linefeed, or newline), #f otherwise.

lowercase?[Function]

Returns #t if the character is in [a-z].

Synopsis

lowercase? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is lowercase (in [a-z]), #f otherwise.

hex-digit?[Function]

Returns #t if the character is a hexadecimal digit.

Synopsis

hex-digit? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a hexadecimal digit; that is, if it is in [0-9], [a-f] or [A-F], #f otherwise.

graphic?[Function]

Returns #t if the character is a graphic character.

Synopsis

graphic? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a printing, non-whitespace character, #f otherwise.

printable?[Function]

Returns #t if the character is printable.

Synopsis

printable? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a printing character, #f otherwise.

punctuation?[Function]

Returns #t if the character is punctuation.

Synopsis

punctuation? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a graphic, non-alphanumeric character, #f otherwise.

control?[Function]

Returns #t if the character is not printable.

Synopsis

control? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a control character, #f otherwise.

byte-character?[Function]

Returns #t if the character is an ASCII character. Could be flaky.

Synopsis

byte-character? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is a byte-character (which is if the integer value of the character returns less than 256. I don't know enough about Unicode and character set encodings to say what this means), #f otherwise.

uppercase?[Function]

Returns #t if the character is uppercase.

Synopsis

uppercase? (character) => (answer)

Parameters

characterAn instance of <character>

Returns

answerAn instance of <boolean>

Description

Returns #t if the character is in [A-Z], #f otherwise.