Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <GULUTIL.H>
Link against: egul.lib

Class TextUtils

class TextUtils;

Description

Provides static functions for truncating and aligning text strings.

Members

Defined in TextUtils:


Member functions


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

IMPORT_C static void ClipToFit(TDes &aBuffer, const CFont &aFont, TInt aMaxWidthInPixels, TChar aAlternativeEnd=KTextUtilClipEndChar);

Description

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.

Parameters

TDes16 &aBuffer

A buffer containing the text to clip.

const CFont &aFont

The font.

TInt aMaxWidthInPixels

The maximum width in pixels.

TChar aAlternativeEnd

The Unicode character to append to the buffer if truncated. By default, this is the horizontal ellipsis.


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

IMPORT_C static TInt ColumnText(TPtrC &aColumnText, TInt aColumn, const TDesC *aSourceText, TChar aColumnSeparator=KColumnListSeparator);

Description

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

Parameters

TPtrC16 &aColumnText

On return, set to the portion of aSourceText that corresponds to the column aColumn.

TInt aColumn

The column to extract. The first column is numbered zero.

const TDesC16 *aSourceText

The source text string that contains one or more column separators.

TChar aColumnSeparator

The character used in aSourceText to separate the columns. By default, a tab character.

Return value

TInt

KErrNotFound if the column number is invalid, otherwise KErrNone.


TruncateToNumChars(TDes &,TInt)

IMPORT_C static void TruncateToNumChars(TDes &aBuffer, TInt numChars);

Description

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.

Parameters

TDes16 &aBuffer

On return, contains the truncated text.

TInt numChars

The number of characters.