/[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.52 by mark, Thu Oct 3 17:26:44 2002 UTC revision 1.53 by mkoch, Thu May 22 07:25:26 2003 UTC
# Line 1  Line 1 
1  /* String.java -- immutable character sequences; the object of string literals  /* String.java -- immutable character sequences; the object of string literals
2     Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
3       Free Software Foundation, Inc.
4    
5  This file is part of GNU Classpath.  This file is part of GNU Classpath.
6    
# Line 38  exception statement from your version. * Line 39  exception statement from your version. *
39    
40  package java.lang;  package java.lang;
41    
42    import java.io.Serializable;
43    import java.io.UnsupportedEncodingException;
44  import java.lang.ref.WeakReference;  import java.lang.ref.WeakReference;
45  import java.util.Comparator;  import java.util.Comparator;
46  import java.util.WeakHashMap;  import java.util.WeakHashMap;
47  import java.util.Locale;  import java.util.Locale;
48  import java.util.regex.Pattern;  import java.util.regex.Pattern;
49  import java.util.regex.PatternSyntaxException;  import java.util.regex.PatternSyntaxException;
 import java.io.Serializable;  
 import java.io.UnsupportedEncodingException;  
50  import java.io.CharConversionException;  import java.io.CharConversionException;
51  import gnu.java.io.EncodingManager;  import gnu.java.io.EncodingManager;
52  import gnu.java.lang.CharData;  import gnu.java.lang.CharData;
# Line 72  import gnu.java.lang.CharData; Line 73  import gnu.java.lang.CharData;
73   *   *
74   * @author Paul N. Fisher   * @author Paul N. Fisher
75   * @author Eric Blake <ebb9@email.byu.edu>   * @author Eric Blake <ebb9@email.byu.edu>
76     * @author Per Bothner <bothner@cygnus.com>
77   * @since 1.0   * @since 1.0
78   * @status updated to 1.4; but could use better data sharing via offset field   * @status updated to 1.4; but could use better data sharing via offset field
79   */   */
# Line 745  public final class String implements Ser Line 747  public final class String implements Ser
747     * character of the string. This is unsatisfactory for locale-based     * character of the string. This is unsatisfactory for locale-based
748     * comparison, in which case you should use {@link java.text.Collator}.     * comparison, in which case you should use {@link java.text.Collator}.
749     *     *
750     * @param s the string to compare against     * @param str the string to compare against
751     * @return the comparison     * @return the comparison
752     * @see Collator#compare(String, String)     * @see Collator#compare(String, String)
753     * @since 1.2     * @since 1.2
754     */     */
755    public int compareToIgnoreCase(String s)    public int compareToIgnoreCase(String str)
756    {    {
757      int i = Math.min(count, s.count);      int i = Math.min(count, str.count);
758      int x = offset;      int x = offset;
759      int y = s.offset;      int y = str.offset;
760      while (--i >= 0)      while (--i >= 0)
761        {        {
762          int result = Character.toLowerCase(Character.toUpperCase(value[x++]))          int result = Character.toLowerCase(Character.toUpperCase(value[x++]))
763            - Character.toLowerCase(Character.toUpperCase(s.value[y++]));            - Character.toLowerCase(Character.toUpperCase(str.value[y++]));
764          if (result != 0)          if (result != 0)
765            return result;            return result;
766        }        }
767      return count - s.count;      return count - str.count;
768    }    }  
769    
770    /**    /**
771     * Predicate which determines if this String matches another String     * Predicate which determines if this String matches another String
# Line 1463  public final class String implements Ser Line 1465  public final class String implements Ser
1465     */     */
1466    public static String valueOf(char[] data)    public static String valueOf(char[] data)
1467    {    {
1468      return new String(data, 0, data.length, false);      return valueOf (data, 0, data.length);
1469    }    }
1470    
1471    /**    /**

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

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