String 的 compareTo 方法
来源:互联网 发布:淘宝会员名是什么意思 编辑:程序博客网 时间:2024/05/22 11:46
Compares the specified stringto this string using the Unicode values of
the characters. Returns 0 ifthe strings contain the same characters in
the same order. Returns anegative integer if the first non-equal
character in this string hasa Unicode value which is less than the
Unicode value of thecharacter at the same position in the specified
string, or if this string isa prefix of the specified string. Returns apositive integer if the first non-equal character inthis string has aUnicode value which isgreater than the Unicode value of the character atthe same position in the specified string, or if thespecified string isprefix of this string.
public int compareTo(String string) {
// Code adapted from K&R, pg 101
int o1 = offset, o2 = string.offset, result;
int end = offset + (count < string.count ? count : string.count);
char[] target = string.value;
while (o1 < end) {
if ((result = value[o1++] - target[o2++]) != 0) {
return result;
}
}
return count - string.count;
}
- String的CompareTo方法
- String 的 compareTo 方法
- String的compareTo方法
- String的compareTo()方法
- String的compareTo方法
- String的compareTo方法
- String 的 compareTo() 方法
- String的compareTo方法的详细说明
- 理解String的compareTo()方法返回值
- String的compareTo()方法返回值
- String的compareTo()方法返回值
- String的compareTo()方法返回值
- java API------String类的compareTo方法
- java的String中的compareTo方法源码
- String的compareTo()方法返回值
- String的compareTo方法底层代码
- 理解String的compareTo()方法返回值
- 理解String的compareTo()方法返回值
- WWDC 2012 有哪些亮点
- Linux系统管理命令之屌丝与高富帅
- JNDI在tomcat中的应用:配置数据源
- libnids分析(3)
- Linux清空内存和磁盘缓存
- String 的 compareTo 方法
- RedHat5.3上安装oracle10g(整理)
- 顺序结构的规范
- JSR303验证出错
- Android开发之ListView 适配器(Adapter)优化
- 今天真高兴
- html5 datalist 标签
- JavaMail学习笔记(六)、搜索邮件
- git commit操作 git恢复删除文件操作