Пример #1
0
//========================  FUNCTION DECLARATION  =====================
// FCT NAME :    CompareNoCase
//---------------------------------------------------------------------
/// \param rhs 
/// \param lhs 
/// \return 
//---------------------------------------------------------------------
// DESCRIPTION :
/// Make a lexicographical comparaison between rhs and lhs. 
///	
//=====================================================================
int UT_CompareNoCase( const UT_String& rhs, const UT_String& lhs )
{
#if defined(TARGET_IOS) || defined(TARGET_MACOS)
  CFStringRef	theString1 = CFStringCreateWithCharactersNoCopy( 0, rhs.data(), rhs.length(), kCFAllocatorNull );
  CFStringRef	theString2 = CFStringCreateWithCharactersNoCopy( 0, lhs.data(), lhs.length(), kCFAllocatorNull );
  CFComparisonResult	result = CFStringCompare( theString1, theString2, kCFCompareCaseInsensitive+kCFCompareLocalized );
  CFRelease( theString1 );
  CFRelease( theString2 );
  return result;
#else
   return rhs.compare_nocase(lhs);
#endif
}