[VSDK] word separator

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Apr 1 00:15:27 CST 2003


on 3/31/03 7:46 PM, Antoine Beyeler at globule at vtx.ch wrote:

> hello,
> 
> Regarding a subject that parallels the discussion we have on
> sub-queries...
> 
> To implement my multi-word search, I need to separate a user-given
> query into multiple words. To operate as well as possible with your
> index mechanism, I need to separate the words just as you do in
> Valentina (for index by word). Is the piece of code that separate words
> public, so I can use it? Or is there a well defined way of doing this?

Hi Antoine,

This is code of that function:

bool FBL_WordArray::GetWord( const char*& pWord, const char*& pWordEnd )
{
    if( pWordEnd )
    {
        if( *pWordEnd == 0 )            // we are at end of string
                return false;
        else    pWord = pWordEnd + 1;     // set pointer to the begin of
next word
    }
    else
    {
        if( *pWord == 0 )                // empty string
            return false;
    }
    
    while( *pWord && !isalnum(uchar(*pWord)) )
        pWord++;

    if( *pWord == 0 )    // there is no more words
        return false;

    pWordEnd = pWord;

    while( *pWordEnd && isalnum(uchar(*pWordEnd)) )
        pWordEnd++;    // loking space character.

    return true;

}  /* FBL_WordArray::GetWord */



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

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



More information about the Valentina mailing list