src/java.base/share/classes/java/lang/Character.java
changeset 49129 fb9f590b9eee
parent 47216 71c04702a3d5
child 49203 3a225d9cabe1
equal deleted inserted replaced
49128:97288886180c 49129:fb9f590b9eee
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
  7566     /**
  7566     /**
  7567      * Returns a {@code String} object representing the
  7567      * Returns a {@code String} object representing the
  7568      * specified {@code char}.  The result is a string of length
  7568      * specified {@code char}.  The result is a string of length
  7569      * 1 consisting solely of the specified {@code char}.
  7569      * 1 consisting solely of the specified {@code char}.
  7570      *
  7570      *
       
  7571      * @apiNote This method cannot handle <a
       
  7572      * href="#supplementary"> supplementary characters</a>. To support
       
  7573      * all Unicode characters, including supplementary characters, use
       
  7574      * the {@link #toString(int)} method.
       
  7575      *
  7571      * @param c the {@code char} to be converted
  7576      * @param c the {@code char} to be converted
  7572      * @return the string representation of the specified {@code char}
  7577      * @return the string representation of the specified {@code char}
  7573      * @since 1.4
  7578      * @since 1.4
  7574      */
  7579      */
  7575     public static String toString(char c) {
  7580     public static String toString(char c) {
  7576         return String.valueOf(c);
  7581         return String.valueOf(c);
       
  7582     }
       
  7583 
       
  7584     /**
       
  7585      * Returns a {@code String} object representing the
       
  7586      * specified character (Unicode code point).  The result is a string of
       
  7587      * length 1 or 2, consisting solely of the specified {@code codePoint}.
       
  7588      *
       
  7589      * @param codePoint the {@code codePoint} to be converted
       
  7590      * @return the string representation of the specified {@code codePoint}
       
  7591      * @exception IllegalArgumentException if the specified
       
  7592      *      {@code codePoint} is not a {@linkplain #isValidCodePoint
       
  7593      *      valid Unicode code point}.
       
  7594      * @since 11
       
  7595      */
       
  7596     public static String toString(int codePoint) {
       
  7597         return String.valueOfCodePoint(codePoint);
  7577     }
  7598     }
  7578 
  7599 
  7579     /**
  7600     /**
  7580      * Determines whether the specified code point is a valid
  7601      * Determines whether the specified code point is a valid
  7581      * <a href="http://www.unicode.org/glossary/#code_point">
  7602      * <a href="http://www.unicode.org/glossary/#code_point">