src/java.base/share/classes/java/lang/String.java
branchJDK-8226585-branch
changeset 58440 4c8a6d1d066c
parent 58109 ee07de0d2c16
equal deleted inserted replaced
58342:ebb1ff3d6707 58440:4c8a6d1d066c
  2886         return isLatin1() ? StringLatin1.lastIndexOfNonWhitespace(value)
  2886         return isLatin1() ? StringLatin1.lastIndexOfNonWhitespace(value)
  2887                           : StringUTF16.lastIndexOfNonWhitespace(value);
  2887                           : StringUTF16.lastIndexOfNonWhitespace(value);
  2888     }
  2888     }
  2889 
  2889 
  2890     /**
  2890     /**
       
  2891      * {@preview {@previewSummary Associated with text blocks,
       
  2892      *                            a preview feature of the Java language.}
       
  2893      *           This method is associated with <i>text blocks</i>, a preview
       
  2894      *           feature of the Java language. Programs can only use this
       
  2895      *           method when preview features are enabled. Preview features
       
  2896      *           may be removed in a future release, or upgraded to permanent
       
  2897      *           features of the Java language.}
       
  2898      *
  2891      * Returns a string whose value is this string, with incidental
  2899      * Returns a string whose value is this string, with incidental
  2892      * {@linkplain Character#isWhitespace(int) white space} removed from
  2900      * {@linkplain Character#isWhitespace(int) white space} removed from
  2893      * the beginning and end of every line.
  2901      * the beginning and end of every line.
  2894      * <p>
  2902      * <p>
  2895      * Incidental {@linkplain Character#isWhitespace(int) white space}
  2903      * Incidental {@linkplain Character#isWhitespace(int) white space}
  2961      * @see String#indent(int)
  2969      * @see String#indent(int)
  2962      * @see Character#isWhitespace(int)
  2970      * @see Character#isWhitespace(int)
  2963      *
  2971      *
  2964      * @since 13
  2972      * @since 13
  2965      *
  2973      *
  2966      * @preview This method is associated with text blocks, a preview language feature.
       
  2967      *          Text blocks and/or this method may be changed or removed in a future release.
       
  2968      */
  2974      */
  2969     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  2975     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  2970                                  essentialAPI=true)
  2976                                  essentialAPI=true)
  2971     public String stripIndent() {
  2977     public String stripIndent() {
  2972         int length = length();
  2978         int length = length();
  3004         }
  3010         }
  3005         return outdent;
  3011         return outdent;
  3006     }
  3012     }
  3007 
  3013 
  3008     /**
  3014     /**
       
  3015      * {@preview {@previewSummary Associated with text blocks,
       
  3016      *                            a preview feature of the Java language.}
       
  3017      *           This method is associated with <i>text blocks</i>, a preview
       
  3018      *           feature of the Java language. Programs can only use this
       
  3019      *           method when preview features are enabled. Preview features
       
  3020      *           may be removed in a future release, or upgraded to permanent
       
  3021      *           features of the Java language.}
       
  3022      *
  3009      * Returns a string whose value is this string, with escape sequences
  3023      * Returns a string whose value is this string, with escape sequences
  3010      * translated as if in a string literal.
  3024      * translated as if in a string literal.
  3011      * <p>
  3025      * <p>
  3012      * Escape sequences are translated as follows;
  3026      * Escape sequences are translated as follows;
  3013      * <table class="striped">
  3027      * <table class="striped">
  3078      * @return String with escape sequences translated.
  3092      * @return String with escape sequences translated.
  3079      *
  3093      *
  3080      * @jls 3.10.7 Escape Sequences
  3094      * @jls 3.10.7 Escape Sequences
  3081      *
  3095      *
  3082      * @since 13
  3096      * @since 13
  3083      *
       
  3084      * @preview  This method is associated with text blocks, a preview language feature.
       
  3085      *           Text blocks and/or this method may be changed or removed in a future release.
       
  3086      */
  3097      */
  3087     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3098     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3088                                  essentialAPI=true)
  3099                                  essentialAPI=true)
  3089     public String translateEscapes() {
  3100     public String translateEscapes() {
  3090         if (isEmpty()) {
  3101         if (isEmpty()) {
  3309     public static String format(Locale l, String format, Object... args) {
  3320     public static String format(Locale l, String format, Object... args) {
  3310         return new Formatter(l).format(format, args).toString();
  3321         return new Formatter(l).format(format, args).toString();
  3311     }
  3322     }
  3312 
  3323 
  3313     /**
  3324     /**
       
  3325      * {@preview Associated with text blocks, a preview feature of
       
  3326      *           the Java language.
       
  3327      *
       
  3328      *           This method is associated with <i>text blocks</i>, a preview
       
  3329      *           feature of the Java language. Programs can only use this
       
  3330      *           method when preview features are enabled. Preview features
       
  3331      *           may be removed in a future release, or upgraded to permanent
       
  3332      *           features of the Java language.}
       
  3333      *
  3314      * Formats using this string as the format string, and the supplied
  3334      * Formats using this string as the format string, and the supplied
  3315      * arguments.
  3335      * arguments.
  3316      *
  3336      *
  3317      * @implSpec This method is equivalent to {@code String.format(this, args)}.
  3337      * @implSpec This method is equivalent to {@code String.format(this, args)}.
  3318      *
  3338      *
  3324      * @see  java.lang.String#format(String,Object...)
  3344      * @see  java.lang.String#format(String,Object...)
  3325      * @see  java.util.Formatter
  3345      * @see  java.util.Formatter
  3326      *
  3346      *
  3327      * @since 13
  3347      * @since 13
  3328      *
  3348      *
  3329      * @preview  This method is associated with text blocks, a preview language feature.
       
  3330      *           Text blocks and/or this method may be changed or removed in a future release.
       
  3331      */
  3349      */
  3332     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3350     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3333                                  essentialAPI=true)
  3351                                  essentialAPI=true)
  3334     public String formatted(Object... args) {
  3352     public String formatted(Object... args) {
  3335         return new Formatter().format(this, args).toString();
  3353         return new Formatter().format(this, args).toString();