[英]Case sensitive order for Strings
There is a String.CASE_INSENSITIVE_ORDER
but why is there no String.CASE_SENSITIVE_ORDER
? 有一个
String.CASE_INSENSITIVE_ORDER
但是为什么没有String.CASE_SENSITIVE_ORDER
? Or is there such an order somewhere hidden? 还是在某处隐藏了这样的命令?
Case-sensitive ordering is the default; 默认区分大小写; ie
String#compareTo
is case-sensitive. 即
String#compareTo
区分大小写。 Therefore, there is no explicit Comparator
for it. 因此,没有明确的
Comparator
器。
Collections.sort(myStringList); // case sensitive ("natural ordering")
Collections.sort(myStringList, String.CASE_INSENSITIVE_ORDER); // case insensitive
因为默认情况下String.CASE_SENSITIVE_ORDER
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.