blob: 47bce77537a68c8f6fe5fa4abb573479899f55f0 [file] [log] [blame]
Alexandre Julliard0d4a5582000-06-13 01:08:29 +00001/*
2 * Unicode string manipulation functions
3 *
4 * Copyright 2000 Alexandre Julliard
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00005 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliard0d4a5582000-06-13 01:08:29 +000019 */
20
21#include "wine/unicode.h"
22
23int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
24{
25 for (;;)
26 {
27 int ret = toupperW(*str1) - toupperW(*str2);
28 if (ret || !*str1) return ret;
29 str1++;
30 str2++;
31 }
32}
33
34int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n )
35{
36 int ret = 0;
37 for ( ; n > 0; n--, str1++, str2++)
38 if ((ret = toupperW(*str1) - toupperW(*str2)) || !*str1) break;
39 return ret;
40}
41
42WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
43{
44 while (*str)
45 {
46 const WCHAR *p1 = str, *p2 = sub;
47 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
48 if (!*p2) return (WCHAR *)str;
49 str++;
50 }
51 return NULL;
52}