如何获取瑞典语的字符串排序顺序 [英] How to get Swedish sort order for strings

查看:57
本文介绍了如何获取瑞典语的字符串排序顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在排序瑞典语字符串时遇到问题.

I am having a problem sorting Swedish strings.

我遇到以下字符问题:v,w,å,ä,ö.

I am having problems with the following characters: v, w, å, ä, ö.

new[] { "ö", "ä", "å", "wa", "va", "wb", "vb", "a"  }
.OrderBy(x => x, new CultureInfo("sv-SE").CompareInfo.GetStringComparer(CompareOptions.None))

预期:a,va,vb,wa,wb,å,ä,ö

Expected: a, va, vb, wa, wb, å, ä, ö

实际:a,va,wa,vb,wb,å,ä,ö

Actual: a, va, wa, vb, wb, å, ä, ö

是否可以选择使它按预期方式对字符串进行排序?

Is the there any option to make it sort the strings as expected?

推荐答案

作为一种变通办法,我切换到文化se-SE(Sami)只是为了在我等待.NET排序规则时正确地对字母字符串进行排序进行更新.

As a work-around I have switched to the culture se-SE (Sami) just for sorting alphabetic strings correctly while I wait for the .NET sorting rules to be updated.

更新:

这是github问题: https://github.com/dotnet/corefx/issues/37753

Here is the github issue: https://github.com/dotnet/corefx/issues/37753

Update2:

问题不在于.NET,而是底层操作系统中定义的排序规则.此错误仅在Windows上出现.

The issue is not with .NET, it is the sorting rules defined in the underlying operating system. This error is only present on Windows.

这篇关于如何获取瑞典语的字符串排序顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆