Archived:Using CFindItemEngine to parse items from text

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia E90 Communicator
Keywords: CFindItemEngine, CFindItemEngine::SFoundItem, CFindItemEngine::ItemCount(), CFindItemEngine::Item(), CFindItemEngine::NextItem()
Created: tapla (22 Apr 2008)
Last edited: lpvalente (22 Aug 2012)



This code snippet demonstrates how to use CFindItemEngine to parse different kinds of items, such as phone numbers, e-mail addresses, or URI addresses, from a given text. The type of the item is given to CFindItemEngine as a parameter when the object is constructed and also several types of items can be searched:

// Parse e-mail addresses from text
CFindItemEngine* searchEngine = CFindItemEngine::NewL(text,
// Parse URLs from text
CFindItemEngine* searchEngine = CFindItemEngine::NewL(text,
// Parse URLs and phone numbers from text
CFindItemEngine* searchEngine = CFindItemEngine::NewL(text,
(CFindItemEngine::EFindItemSearchURLBin |

This snippet can be self-signed.

MMP file

The following libraries are required:

LIBRARY CommonEngine.lib

Source file

TBuf<256> text = _L("E-mail: foo.bar@invalid.com, Tel: 0700 468833, Www: http://www.testsite.net/.");
// Create an instance of CFindItemEngine to find every e-mail address from the text above
CFindItemEngine* searchEngine = CFindItemEngine::NewL(text,
// Retrieve the number of items
TInt count = searchEngine->ItemCount();
// Get currently selected item to the item variable
CFindItemEngine::SFoundItem item;
// Display every item
for (TInt i = 0; i < count; i++)
TPtrC result = text.Mid(item.iStartPos, item.iLength);
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
// Get the next item to the item variable
delete searchEngine;


Every e-mail address from the specific text is displayed on the screen.

This page was last modified on 22 August 2012, at 14:30.
51 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.