PROBLEM with word iterator

Ruslan Zasukhin <[email protected]> Tue, 09 Nov 2004 19:55:54 +0200
Newsgroups gmane.comp.lib.icu.general
Message-ID <BDB6D14A.230B4%[email protected]>
Hi All,

I have made word iterator

    UErrorCode status = U_ZERO_ERROR;
    mpIter = BreakIterator::createWordInstance( *pLocale, status );



And I do e.g. Counting of words:

ulong Index_String::CountWords( const UChar* inWords )
{
    ulong res = 0;

    mpIter->setText( inWords );

    long start = mpIter->first();
    if( start == BreakIterator::DONE )
        return res;
    
    while( true ) 
    {
        long next = mpIter->next();
        
        if( next == BreakIterator::DONE )
            return res;
        
        if( u_isalnum(inWords[start]) )
            ++res;

        start = next;
    }

    // never reached.
    return 0;    
}


--------------------------------
PROBLEM IS:

If I send string "aa.dd bbb"

Then BreakIterator's next() return me the boundaries  0 and 5

In other words it consider "aa.dd" as single word.

Why is this ???

The same is for any punctuation characater  , / = - + *

I use ICU 3.0 btw.



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: [email protected]
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------