欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

String源码疑惑,string源码,public boole

来源: javaer 分享于  点击 36839 次 点评:42

String源码疑惑,string源码,public boole


public boolean regionMatches(boolean ignoreCase, int toffset,                          String other, int ooffset, int len) {       char ta[] = value;       int to = offset + toffset;       char pa[] = other.value;       int po = other.offset + ooffset;       // Note: toffset, ooffset, or len might be near -1>>>1.       if ((ooffset < 0) || (toffset < 0) || (toffset > (long)count - len) ||               (ooffset > (long)other.count - len)) {           return false;       }       while (len-- > 0) {           char c1 = ta[to++];           char c2 = pa[po++];           if (c1 == c2) {               continue;           }           if (ignoreCase) {               // If characters don't match but case may be ignored,               // try converting both characters to uppercase.               // If the results match, then the comparison scan should               // continue.               char u1 = Character.toUpperCase(c1);               char u2 = Character.toUpperCase(c2);               if (u1 == u2) {                   continue;               }               // Unfortunately, conversion to uppercase does not work properly               // for the Georgian alphabet, which has strange rules about case               // conversion.  So we need to make one last check before               // exiting.               if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {                   continue;               }           }           return false;       }       return true;   }//该片段来自于http://byrx.net
相关栏目:

用户点评