viksoe.dk

CFixedString class


This article was submitted .


The CFixedString class implements a CString-like class with a fixed-length string buffer.
The string buffer will be allocated on the stack and its size is determined using a class template argument.

The class uses the TCHAR.H runtime library for all its string manipulations. This makes it UNICODE and multi-byte aware, but also dependant on the C Runtime Library.

Interface

 NameDescription
CFixedString()Default constructor.
CFixedString(TCHAR ch)Constructor, which take a single character.
CFixedString(LPCTSTR lpsz)Constructor that initialized the string right away.
GetLengthReturns the size of the string.
IsEmptyReturns TRUE if the string is empty.
EmptyClears the string.
operator LPCTSTROperator overload. Returns a pointer to the string.
operator +Operator overload. Concatenate strings.
other operatorsCompares the string (==, !=, < etc operators).
CompareCompares the string.
MakeUpperConverts the string to uppercase.
MakeLowerConverts the string to lowercase.
LeftReturns a substring starting from the first position.
RightReturns a substring starting from the end of the string.
MidReturns a substring.
FindFinds the first occurence of a character/substring in the string.

Download Files

DownloadSource Code (3 Kb)

To the top