TextUtils Class Reference

#include <mw/gulutil.h>

Link against: egul.lib

class TextUtils
Public Member Functions
IMPORT_C voidClipToFit(TDes &, const CFont &, TInt, TChar)
IMPORT_C TIntColumnText(TPtrC &, TInt, const TDesC *, TChar)
IMPORT_C voidTruncateToNumChars(TDes &, TInt)

Detailed Description

Provides static functions for truncating and aligning text strings.

Member Function Documentation

ClipToFit ( TDes &, const CFont &, TInt, TChar )

IMPORT_C voidClipToFit(TDes &aBuffer,
const CFont &aFont,
TCharaAlternativeEnd =  KTextUtilClipEndChar

Clips text to fit into a maximum width.

If the text is too wide to fit in the width when displayed in aFont, it is truncated and the specified character (by default, a horizontal ellipsis) is appended to it.

aBufferA buffer containing the text to clip.
aFontThe font.
aMaxWidthInPixelsThe maximum width in pixels.
aAlternativeEndThe Unicode character to append to the buffer if truncated. By default, this is the horizontal ellipsis.

ColumnText ( TPtrC &, TInt, const TDesC *, TChar )

IMPORT_C TIntColumnText(TPtrC &aColumnText,
const TDesC *aSourceText,
TCharaColumnSeparator =  KColumnListSeparator

Gets a portion of text from a descriptor, corresponding to a requested column.

aColumnTextOn return, set to the portion of aSourceText that corresponds to the column aColumn.
aColumnThe column to extract. The first column is numbered zero.
aSourceTextThe source text string that contains one or more column separators.
aColumnSeparatorThe character used in aSourceText to separate the columns. By default, a tab character.
Return Value
KErrNotFound if the column number is invalid, otherwise KErrNone.

TruncateToNumChars ( TDes &, TInt )

IMPORT_C voidTruncateToNumChars(TDes &aBuffer,

Truncates text to a number of characters.

If truncation is required (because aBuffer contains more than numChars characters), an ellipsis is added to the text as the last character.

aBufferOn return, contains the truncated text.
numCharsThe number of characters.