string.join()

String.join(delimiter, string1, string2,...) Joins the input strings by using delimiter and returns a string.
Here are some examples with output.
System.out.println(String.join("|", "Welcome","To","plus2net"));
System.out.println(String.join("/", "07","02","2020")); // 07/02/2020
System.out.println(String.join("|", "Welcome",null,"home"));
System.out.println(String.join("@", "userid","example.com"));
Output
Welcome|To|plus2net
07/02/2020
Welcome|null|home
userid@example.com
The first line simply joins three strings by using a delimiter.
The second line joins date, month and year parts by using / as delimiter.
The third line uses null as one of the string input and the same is used in final output.
In the last line one email address is created by using userid and domain name parts.

All String functions

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer