Useful string function in inputwin.cxx

Philipp Weissenbacher p.weissenbacher at gmail.com
Thu Jun 19 13:18:28 PDT 2014


Hi all,

I've just finished translating Calc's inputwin.cxx and noticed the
following (local static) function:

static sal_Int32 findFirstNonMatchingChar(const OUString& rStr1, const
OUString& rStr2)
{
    // Search the string for unmatching chars
    const sal_Unicode*  pStr1 = rStr1.getStr();
    const sal_Unicode*  pStr2 = rStr2.getStr();
    sal_Int32      i = 0;
    while ( i < rStr1.getLength() )
    {
        // Abort on the first unmatching char
        if ( *pStr1 != *pStr2 )
            return i;
        ++pStr1,
        ++pStr2,
        ++i;
    }

    return i;
}

Would that be something one could move to another place (like ustring.cxx)
where other code could use it too?

Regards
Philipp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140619/edc69f88/attachment.html>


More information about the LibreOffice mailing list