的String.Compare的不同的重载的区别 [英] Difference between the different overloads of String.Compare

查看:239
本文介绍了的String.Compare的不同的重载的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体是什么

我觉得,使用第二个提供更多的选择(对比任何培养而不是仅在当前的一个或不变的,忽略特殊字符,忽略片假名的宽度(!!)等...)的than第一个。两人都被引入了它在.NET 2.0,所以我想它不可能是向后兼容的问题。

I feel like that the second one offers more options (comparison using any culture instead of only the current one or invariant one, ignore special characters, ignore the width of katakanas (!!) etc...) than the first one. Both have been introduced it in .NET 2.0 so I guess it can't be a question of backward compatibility.

那么,有什么区别,当我应该使用第一个,当我应该使用第二个?

So what's the difference and when should I use the first one and when should I use the second one?

我看了一下<一href="http://stackoverflow.com/questions/44288/differences-in-string-compare-methods-in-c-sharp">this帖子这文章,但我认为他们正在处理一个稍微不同的问题。

I had a look at this post and this article, but I think they're dealing with a slightly different matters.

推荐答案

您的答案是在备注栏第二个过载。

Your answer is in the remarks for the second overload.

http://msdn.microsoft.com/en-us/library/ cc190529.aspx

的比较使用培养参数以获得培养特定的信息,如套管规则和单个字符的字母顺序,例如,一个特定的培养可以指定字符的某些组合被视为一个单个字符,大写和小写字符以特定方式进行比较,或者说一个字的排序顺序取决于字符precede还是遵循它。

其他重载只使用默认的文化。

The other overload just uses the default culture.

这篇关于的String.Compare的不同的重载的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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