EasyManuals Logo

Casio ClassPad 300 Programming Guide

Casio ClassPad 300
125 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #101 background imageLoading...
Page #101 background image
unsigned int ByteLength() const {return m_byteLength;}
unsigned int Length() const {return m_charLength;}
unsigned int ByteLengthTo(int charOffset);
int IsEmpty();
Notice that the first two functions are called ByteLength() and Length(). If you
remember, CPStrings are made to hold single-byte or multiple-byte characters. This
means that a string’s byte length is not always equal to its character length. Be
careful when allocating a string to use ByteLength() and not Length().
ByteLengthTo() converts a character offset to a byte offset and IsEmpty() returns a 1 if
the string is not empty.
For example usage of some of these functions, take a look at the following code:
CP_CHAR multi[3]={0xEE,0x6E,0};
CPString str1((PEGCHAR*)multi); //multi-byte character
CPString str2("2");
int j;
j = str1.ByteLength(); // j=2
j = str1.Length()); // j=1
j = str2.ByteLength(); // j=1
j = str2.Length(); // j=1
You can change the case of a string with the following functions:
void ToggleCase();
void UpperCase();
void LowerCase();
You can return the substring of a string by using the Mid() or Left() :
CPString Mid(int charOffset);
CPString Left(int charOffset);
Left() returns a sub-string from the beginning of the string to the character offset
charOffset. Whereas Mid() extracts a sub-string from the end of the string to the
character offset charOffset.
To clear the contents of a CPString use:
void Clear();
Finally, you can replace all of the occurrences of a character in a CPString with:
void ReplaceCharacter(CPMCHAR c0, CPMCHAR c1);
101

Table of Contents

Other manuals for Casio ClassPad 300

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio ClassPad 300 and is the answer not in the manual?

Casio ClassPad 300 Specifications

General IconGeneral
BrandCasio
ModelClassPad 300
CategoryCalculator
LanguageEnglish

Related product manuals