utf-8字符串的strcasecmp()无法正常运行(MacOSX,iOS)

时间:2018-08-29 01:08:26

标签: ios macos locale

我想念什么?

// Excerpt from some .mm source file:
std::set locale(LC_ALL, "ru_RU.UTF-8");
int rv = strcasecmp([@"слово" UTF8String], [@"СЛОВО" UTF8String]);
assert(rv == 0);

我希望不区分大小写的比较能够成功完成,但是实际上我正在使用strcasecmp的非零返回码。

1 个答案:

答案 0 :(得分:0)

var compositor = Window.Current.Compositor; var easeIn = compositor.CreateCubicBezierEasingFunction(new Vector2(0.6f, 0.0f), new Vector2(0.9f, 0.0f)); var linear = compositor.CreateLinearEasingFunction(); var colorAnimation = compositor.CreateColorKeyFrameAnimation(); // 0.0f means at 0% of the total duration of 5s, 0.2f means 20%, etc. colorAnimation.InsertKeyFrame(0.0f, Colors.Red, linear); colorAnimation.InsertKeyFrame(0.2f, Colors.DarkOrange, easeIn); colorAnimation.InsertKeyFrame(0.4f, Colors.Green, linear); colorAnimation.InsertKeyFrame(0.6f, Colors.Purple, easeIn); colorAnimation.InsertKeyFrame(0.8f, Colors.DarkSlateGray, linear); colorAnimation.InsertKeyFrame(1.0f, Colors.Black, linear); colorAnimation.Duration = TimeSpan.FromSeconds(5); colorAnimation.IterationBehavior = AnimationIterationBehavior.Forever; // Note the control exposes the inner DropShadow property, and this is the property we want to animate ChristmasBonusStarUpperDropShadowPolygon.DropShadow.StartAnimation("Color", colorAnimation); 不起作用的原因是it's useless on multibyte strings

由于您似乎正在使用strcasecmp()

Objective-C++

这应该适用于不区分大小写的匹配。

Searching, Comparing, and Sorting Strings