Substring method

Eike Rathke erack at redhat.com
Sat Jan 31 08:16:52 PST 2015


Hi Mihály,

On Thursday, 2015-01-29 14:57:58 +0100, Mihály Palenik wrote:

> I'd like to examine a string is part of another but in all languages. I
> know CollatorWrapper class which has compareString method to compare two
> strings using uno. I'm searching this kind of method.

For case significant comparisons and literal string in string search you
can use OUString::indexOf()

As soon as the search shall be done case insignificant you'll have to
transliterate and for that you need to specify the language.

If the searched string should be the start of a string you could use
TransliterationWrapper::equals() from
include/unotools/transliterationwrapper.hxx

If the search string can appear anywhere the practical approach is to
transliterate both strings to, for example, lowercase and then use
OUString::indexOf() to search the occurrence.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150131/f5a9c564/attachment.sig>


More information about the LibreOffice mailing list