![](/img/trans.png)
[英]Simple way to sort strings in the (case sensitive) alphabetical order
[英]Case sensitive order for Strings
有一个String.CASE_INSENSITIVE_ORDER
但是为什么没有String.CASE_SENSITIVE_ORDER
? 还是在某处隐藏了这样的命令?
默认区分大小写; 即String#compareTo
区分大小写。 因此,没有明确的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.