# HG changeset patch # User jlaskey # Date 1525782462 10800 # Node ID f5231f5762fc5d0e1724e63f5e5071328720d1ef # Parent 0d4920ac269ca8255c5a4572fb163a3d56d53839 8200372: String::trim JavaDoc should clarify meaning of space Reviewed-by: sundar diff -r 0d4920ac269c -r f5231f5762fc src/java.base/share/classes/java/lang/String.java --- a/src/java.base/share/classes/java/lang/String.java Tue May 08 10:49:59 2018 +0200 +++ b/src/java.base/share/classes/java/lang/String.java Tue May 08 09:27:42 2018 -0300 @@ -2599,35 +2599,36 @@ } /** - * Returns a string whose value is this string, with any leading and trailing - * whitespace removed. + * Returns a string whose value is this string, with all leading + * and trailing space removed, where space is defined + * as any character whose codepoint is less than or equal to + * {@code '\u005Cu0020'} (the space character). *

* If this {@code String} object represents an empty character * sequence, or the first and last characters of character sequence * represented by this {@code String} object both have codes - * greater than {@code '\u005Cu0020'} (the space character), then a + * that are not space (as defined above), then a * reference to this {@code String} object is returned. *

- * Otherwise, if there is no character with a code greater than - * {@code '\u005Cu0020'} in the string, then a - * {@code String} object representing an empty string is - * returned. + * Otherwise, if all characters in this string are space (as + * defined above), then a {@code String} object representing an + * empty string is returned. *

* Otherwise, let k be the index of the first character in the - * string whose code is greater than {@code '\u005Cu0020'}, and let + * string whose code is not a space (as defined above) and let * m be the index of the last character in the string whose code - * is greater than {@code '\u005Cu0020'}. A {@code String} + * is not a space (as defined above). A {@code String} * object is returned, representing the substring of this string that * begins with the character at index k and ends with the * character at index m-that is, the result of * {@code this.substring(k, m + 1)}. *

- * This method may be used to trim whitespace (as defined above) from + * This method may be used to trim space (as defined above) from * the beginning and end of a string. * - * @return A string whose value is this string, with any leading and trailing white - * space removed, or this string if it has no leading or - * trailing white space. + * @return a string whose value is this string, with all leading + * and trailing space removed, or this string if it + * has no leading or trailing space. */ public String trim() { String ret = isLatin1() ? StringLatin1.trim(value)