Sunday 24 November 2019

Java equivalents of C# String.Format() and String.Join()



I know this is a bit of a newbie question, but are there equivalents to C#'s string operations in Java?




Specifically, I'm talking about String.Format and String.Join.


Answer



The Java String object has a format method (as of 1.5), but no join method.



To get a bunch of useful String utility methods not already included you could use org.apache.commons.lang.StringUtils.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...