|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.truth.StringUtil
public final class StringUtil
Utilities for string comparisons.
Method Summary | |
---|---|
static String |
format(String template,
Object... args)
Substitutes each %s in template with an argument. |
static String |
messageFor(String message,
CharSequence expected,
CharSequence actual)
Returns a message appropriate for string comparisons. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String messageFor(String message, CharSequence expected, CharSequence actual)
ComparisonFailure
does.
public static String format(String template, Object... args)
%s
in template
with an argument. These
are matched by position - the first %s
gets args[0]
, etc.
If there are more arguments than placeholders, the unmatched arguments will
be appended to the end of the formatted message in square braces.
Cribbed from Guava's Preconditions
to allow for a
GWT-compatible alternative to String.format(String, Object...)
template
- a non-null string containing 0 or more %s
placeholders.args
- the arguments to be substituted into the message
template. Arguments are converted to strings using
String.valueOf(Object)
. Arguments can be null.Preconditions
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |