Characters: The std.uni Module

In this lesson, we explore the functions of the std.uni module.

The std.uni module #

The std.uni module includes functions that are useful with unicode characters. You can see this module in its documentation.
The functions that start with “is” answer certain questions about characters. The result is false or true depending on whether the answer is no or yes, respectively. These functions are useful in logical expressions:

  • isLower: is it a lowercase character?

  • isUpper: is it an uppercase character?

  • isAlpha: is it a Unicode alphabetic character?

  • isWhite: is it a whitespace character?

The functions that start with “to” produce new characters from existing ones:

  • toLower: produces the lowercase version of the given character.

  • toUpper: produces the uppercase version of the given character.

Here is a program that uses all these functions:

Get hands-on with 1400+ tech skills courses.