tcharexample: TChar example

This example application demonstrates how to use TChar, TCharF, TCharLC and TCharUC classes.

Purpose

TChar represents a single character. It stores the character's value as a 32-bit unsigned integer and it provides various functions to manipulate the character and retrieve its properties.

TChar and its derived classes can be used to represent Unicode values outside plane 0 (that is, Unicode values within the extended Unicode range from 0x10000 to 0xFFFFF). This differentiates them from the related class TText, which can only be used for 16-bit Unicode character values.

Class summary

  • TChar - Holds a character value and provides a number of utility functions to manipulate it and test its properties.

  • TCharF - Folds a specified character and provides functions to fold additional characters after construction of the object.

  • TCharLC - Converts a specified character to lower case and provides functions to convert additional characters after construction of the object.

  • TCharUC - Converts a specified character to upper case and provides functions to convert additional characters after construction of the object.

Download

Click on the following link to download the example: tcharexample.zip.

click: browse to view the example code.

Design and implementation

Using TChar

The example retrieves information about a character using:

Using TCharF, TCharLC and TCharUC

Related APIs

TCharF represents a folded character. The example demonstrates how folding a character removes case and accent distinctions.

The example also demonstrates converting characters between lower and upper case using TCharLC and TCharUC.

Building and configuring

To build the example:

  • You can build the example from your IDE or the command line.

    If you use an IDE, import the bld.inf file of the example into your IDE, and use the build command of the IDE.

    If you use the command line, open a command prompt, and set the current directory to the source code directory of the example. You can then build the example with the SBSv1 build tools with the following commands:

    bldmake bldfiles

    abld build

    How to use bldmake and How to use abld describe how to use the SBSv1 build tools.

  • For the emulator, the example builds an executable called tcharexample.exe in the epoc32\release\winscw\<udeb or urel>\ folder.

Running the example

The example application displays a list of options and sub options to the user and takes input from the user.

Figure 1. Screenshot for TChar example