mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8203444: String::formatted (Preview)
Reviewed-by: smarks, rriggs, sherman
This commit is contained in:
parent
fead01f2c9
commit
9c6c6eae1d
2 changed files with 79 additions and 0 deletions
|
@ -3313,6 +3313,30 @@ public final class String
|
|||
return new Formatter(l).format(format, args).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats using this string as the format string, and the supplied
|
||||
* arguments.
|
||||
*
|
||||
* @implSpec This method is equivalent to {@code String.format(this, args)}.
|
||||
*
|
||||
* @param args
|
||||
* Arguments referenced by the format specifiers in this string.
|
||||
*
|
||||
* @return A formatted string
|
||||
*
|
||||
* @see java.lang.String#format(String,Object...)
|
||||
* @see java.util.Formatter
|
||||
*
|
||||
* @since 13
|
||||
*
|
||||
* @deprecated This method is associated with text blocks, a preview language feature.
|
||||
* Text blocks and/or this method may be changed or removed in a future release.
|
||||
*/
|
||||
@Deprecated(forRemoval=true, since="13")
|
||||
public String formatted(Object... args) {
|
||||
return new Formatter().format(this, args).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of the {@code Object} argument.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue