src/java.base/share/classes/java/lang/String.java
changeset 58713 ad69fd32778e
parent 58242 94bb65cb37d3
equal deleted inserted replaced
58712:14e098407bb0 58713:ad69fd32778e
  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 Associated with text blocks, a preview feature of
       
  2892      *           the Java language.
       
  2893      *
       
  2894      *           This method is associated with <i>text blocks</i>, a preview
       
  2895      *           feature of the Java language. Programs can only use this
       
  2896      *           method when preview features are enabled. Preview features
       
  2897      *           may be removed in a future release, or upgraded to permanent
       
  2898      *           features of the Java language.}
       
  2899      *
  2891      * Returns a string whose value is this string, with incidental
  2900      * Returns a string whose value is this string, with incidental
  2892      * {@linkplain Character#isWhitespace(int) white space} removed from
  2901      * {@linkplain Character#isWhitespace(int) white space} removed from
  2893      * the beginning and end of every line.
  2902      * the beginning and end of every line.
  2894      * <p>
  2903      * <p>
  2895      * Incidental {@linkplain Character#isWhitespace(int) white space}
  2904      * Incidental {@linkplain Character#isWhitespace(int) white space}
  2961      * @see String#indent(int)
  2970      * @see String#indent(int)
  2962      * @see Character#isWhitespace(int)
  2971      * @see Character#isWhitespace(int)
  2963      *
  2972      *
  2964      * @since 13
  2973      * @since 13
  2965      *
  2974      *
  2966      * @deprecated  This method is associated with text blocks, a preview language feature.
  2975      */
  2967      *              Text blocks and/or this method may be changed or removed in a future release.
  2976     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  2968      */
  2977                                  essentialAPI=true)
  2969     @Deprecated(forRemoval=true, since="13")
       
  2970     public String stripIndent() {
  2978     public String stripIndent() {
  2971         int length = length();
  2979         int length = length();
  2972         if (length == 0) {
  2980         if (length == 0) {
  2973             return "";
  2981             return "";
  2974         }
  2982         }
  3003         }
  3011         }
  3004         return outdent;
  3012         return outdent;
  3005     }
  3013     }
  3006 
  3014 
  3007     /**
  3015     /**
       
  3016      * {@preview Associated with text blocks, a preview feature of
       
  3017      *           the Java language.
       
  3018      *
       
  3019      *           This method is associated with <i>text blocks</i>, a preview
       
  3020      *           feature of the Java language. Programs can only use this
       
  3021      *           method when preview features are enabled. Preview features
       
  3022      *           may be removed in a future release, or upgraded to permanent
       
  3023      *           features of the Java language.}
       
  3024      *
  3008      * Returns a string whose value is this string, with escape sequences
  3025      * Returns a string whose value is this string, with escape sequences
  3009      * translated as if in a string literal.
  3026      * translated as if in a string literal.
  3010      * <p>
  3027      * <p>
  3011      * Escape sequences are translated as follows;
  3028      * Escape sequences are translated as follows;
  3012      * <table class="striped">
  3029      * <table class="striped">
  3077      * @return String with escape sequences translated.
  3094      * @return String with escape sequences translated.
  3078      *
  3095      *
  3079      * @jls 3.10.7 Escape Sequences
  3096      * @jls 3.10.7 Escape Sequences
  3080      *
  3097      *
  3081      * @since 13
  3098      * @since 13
  3082      *
  3099      */
  3083      * @deprecated  This method is associated with text blocks, a preview language feature.
  3100     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3084      *              Text blocks and/or this method may be changed or removed in a future release.
  3101                                  essentialAPI=true)
  3085      */
       
  3086     @Deprecated(forRemoval=true, since="13")
       
  3087     public String translateEscapes() {
  3102     public String translateEscapes() {
  3088         if (isEmpty()) {
  3103         if (isEmpty()) {
  3089             return "";
  3104             return "";
  3090         }
  3105         }
  3091         char[] chars = toCharArray();
  3106         char[] chars = toCharArray();
  3307     public static String format(Locale l, String format, Object... args) {
  3322     public static String format(Locale l, String format, Object... args) {
  3308         return new Formatter(l).format(format, args).toString();
  3323         return new Formatter(l).format(format, args).toString();
  3309     }
  3324     }
  3310 
  3325 
  3311     /**
  3326     /**
       
  3327      * {@preview Associated with text blocks, a preview feature of
       
  3328      *           the Java language.
       
  3329      *
       
  3330      *           This method is associated with <i>text blocks</i>, a preview
       
  3331      *           feature of the Java language. Programs can only use this
       
  3332      *           method when preview features are enabled. Preview features
       
  3333      *           may be removed in a future release, or upgraded to permanent
       
  3334      *           features of the Java language.}
       
  3335      *
  3312      * Formats using this string as the format string, and the supplied
  3336      * Formats using this string as the format string, and the supplied
  3313      * arguments.
  3337      * arguments.
  3314      *
  3338      *
  3315      * @implSpec This method is equivalent to {@code String.format(this, args)}.
  3339      * @implSpec This method is equivalent to {@code String.format(this, args)}.
  3316      *
  3340      *
  3322      * @see  java.lang.String#format(String,Object...)
  3346      * @see  java.lang.String#format(String,Object...)
  3323      * @see  java.util.Formatter
  3347      * @see  java.util.Formatter
  3324      *
  3348      *
  3325      * @since 13
  3349      * @since 13
  3326      *
  3350      *
  3327      * @deprecated  This method is associated with text blocks, a preview language feature.
  3351      */
  3328      *              Text blocks and/or this method may be changed or removed in a future release.
  3352     @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
  3329      */
  3353                                  essentialAPI=true)
  3330     @Deprecated(forRemoval=true, since="13")
       
  3331     public String formatted(Object... args) {
  3354     public String formatted(Object... args) {
  3332         return new Formatter().format(this, args).toString();
  3355         return new Formatter().format(this, args).toString();
  3333     }
  3356     }
  3334 
  3357 
  3335     /**
  3358     /**