sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Implement case-insensitive comparison using the full folded comparison sl@0: // functions of E32 sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Compares the null-terminated strings left and right and returns an integer sl@0: greater than,equal to, or less than zero (0), accordingly as left sl@0: is lexicographically greater than,equal to, or less than right after sl@0: translation of each corresponding character to lowercase. sl@0: @return an integer greater than, equal to, or less than zero (0), sl@0: accordingly as the string left is greater than, equal to, sl@0: or less than the string right. sl@0: @param left The first string to compare. sl@0: @param right The second string to compare. sl@0: */ sl@0: extern "C" EXPORT_C int strcasecmp (const char *left, const char *right) sl@0: { sl@0: TPtrC8 Left((const TText8*)left); sl@0: TPtrC8 Right((const TText8*)right); sl@0: return Left.CompareF(Right); sl@0: } sl@0: sl@0: extern "C" EXPORT_C int strncasecmp (const char *left, const char *right, size_t length) sl@0: { sl@0: TUint leftlength=strlen(left); sl@0: TUint rightlength=strlen(right); sl@0: // The length parameter is the maximum amount of the string to be searched, sl@0: // so truncate the descriptors appropriately sl@0: if (leftlength>length) sl@0: leftlength=length; sl@0: if (rightlength>length) sl@0: rightlength=length; sl@0: TPtrC8 Left((const TText8*)left,leftlength); sl@0: TPtrC8 Right((const TText8*)right,rightlength); sl@0: return Left.CompareF(Right); sl@0: }