RFR - JDK-8203444 String::formatted (Preview)

Jim Laskey james.laskey at oracle.com
Tue May 21 14:32:47 UTC 2019


Please do a code review of the new String::formatted instance method. This method was originally introduced under the name "format" in conjunction with Raw String Literals. The method is being reintroduced in conjunction with Text Blocks and renamed to avoid method resolution conflicts against the static method String::format.

Example of use:

    String name = "Smith, Pat";
    String address = "123 Maple St., Anytown, Anywhere";
    String phone = "999-555-1234";
    String client = """
                    Name: %s
		    Address: %s
		    Phone: %s
                    """.formatted(name, address, phone); 

Thank you.

-- Jim

webrev: http://cr.openjdk.java.net/~jlaskey/8203444/webrev-01 <http://cr.openjdk.java.net/~jlaskey/8203444/webrev-01>
jbs: https://bugs.openjdk.java.net/browse/JDK-8203444 <https://bugs.openjdk.java.net/browse/JDK-8203444>
csr: https://bugs.openjdk.java.net/browse/JDK-8203630 <https://bugs.openjdk.java.net/browse/JDK-8203630>




More information about the core-libs-dev mailing list