/[classpath]/classpath/java/lang/String.java
ViewVC logotype

Diff of /classpath/java/lang/String.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by ericb, Tue Mar 19 15:55:59 2002 UTC revision 1.42 by ericb, Thu Mar 21 22:30:08 2002 UTC
# Line 1096  public final class String implements Ser Line 1096  public final class String implements Ser
1096      if (oldChar == newChar)      if (oldChar == newChar)
1097        return this;        return this;
1098      int i = count;      int i = count;
1099      int x = offset;      int x = offset - 1;
1100      while (--i >= 0)      while (--i >= 0)
1101        if (value[x++] == oldChar)        if (value[++x] == oldChar)
1102          break;          break;
1103      if (i < 0)      if (i < 0)
1104        return this;        return this;
# Line 1108  public final class String implements Ser Line 1108  public final class String implements Ser
1108        if (value[++x] == oldChar)        if (value[++x] == oldChar)
1109          newStr[x] = newChar;          newStr[x] = newChar;
1110      // Package constructor avoids an array copy.      // Package constructor avoids an array copy.
1111      return new String(newStr, 0, count, true);      return new String(newStr, offset, count, true);
1112    }    }
1113    
1114    /**    /**
# Line 1245  public final class String implements Ser Line 1245  public final class String implements Ser
1245      // First, see if the current string is already lower case.      // First, see if the current string is already lower case.
1246      boolean turkish = "tr".equals(loc.getLanguage());      boolean turkish = "tr".equals(loc.getLanguage());
1247      int i = count;      int i = count;
1248      int x = offset;      int x = offset - 1;
1249      while (--i >= 0)      while (--i >= 0)
1250        {        {
1251          char ch = value[x++];          char ch = value[++x];
1252          if ((turkish && ch == '\u0049')          if ((turkish && ch == '\u0049')
1253              || ch != Character.toLowerCase(ch))              || ch != Character.toLowerCase(ch))
1254            break;            break;
# Line 1263  public final class String implements Ser Line 1263  public final class String implements Ser
1263        {        {
1264          char ch = value[x];          char ch = value[x];
1265          // Hardcoded special case.          // Hardcoded special case.
1266          newStr[x] = (turkish && ch == '\u0049') ? '\u0131'          newStr[x++] = (turkish && ch == '\u0049') ? '\u0131'
1267            : Character.toLowerCase(ch);            : Character.toLowerCase(ch);
         x++;  
1268        }        }
1269      while (--i >= 0);      while (--i >= 0);
1270      // Package constructor avoids an array copy.      // Package constructor avoids an array copy.
1271      return new String(newStr, 0, count, true);      return new String(newStr, offset, count, true);
1272    }    }
1273    
1274    /**    /**
# Line 1304  public final class String implements Ser Line 1303  public final class String implements Ser
1303      boolean turkish = "tr".equals(loc.getLanguage());      boolean turkish = "tr".equals(loc.getLanguage());
1304      int expand = 0;      int expand = 0;
1305      boolean unchanged = true;      boolean unchanged = true;
1306      int x = count + offset;      int i = count;
1307      for (int i = count; --i >= 0; )      int x = i + offset;
1308        while (--i >= 0)
1309        {        {
1310          char ch = value[--x];          char ch = value[--x];
1311          expand += upperCaseExpansion(ch);          expand += upperCaseExpansion(ch);
# Line 1317  public final class String implements Ser Line 1317  public final class String implements Ser
1317        return this;        return this;
1318    
1319      // Now we perform the conversion.      // Now we perform the conversion.
1320        i = count;
1321      if (expand == 0)      if (expand == 0)
1322        {        {
1323          char[] newStr = (char[]) value.clone();          char[] newStr = (char[]) value.clone();
         int i = count;  
1324          while (--i >= 0)          while (--i >= 0)
1325            {            {
1326              char ch = value[x];              char ch = value[x];
# Line 1329  public final class String implements Ser Line 1329  public final class String implements Ser
1329                : Character.toUpperCase(ch);                : Character.toUpperCase(ch);
1330            }            }
1331          // Package constructor avoids an array copy.          // Package constructor avoids an array copy.
1332          return new String(newStr, 0, count, true);          return new String(newStr, offset, count, true);
1333        }        }
1334    
1335      // Expansion is necessary.      // Expansion is necessary.
1336      char[] newStr = new char[count + expand];      char[] newStr = new char[count + expand];
1337      for (int i = 0, j = 0; i++ < count; )      int j = 0;
1338        while (--i >= 0)
1339        {        {
1340          char ch = value[x++];          char ch = value[x++];
1341          // Hardcoded special case.          // Hardcoded special case.

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26