C#中的String.Format()和的string.join了Java当量()
问题描述:
我知道这是一个有点新手的问题,但是否有等同C#的字符串操作在Java中?
I know this is a bit of a newbie question, but are there equivalents to C#'s string operations in Java?
具体来说,我说的是的String.Format
和的string.join
。
Specifically, I'm talking about String.Format
and String.Join
.
答
在Java String对象有一个格式
方法(如1.5),但没有加入
方法。
The Java String object has a format
method (as of 1.5), but no join
method.
要得到一堆尚未包括你可以使用字符串有用实用方法org.apache.commons.lang.StringUtils.
To get a bunch of useful String utility methods not already included you could use org.apache.commons.lang.StringUtils.