Package com.booksaw.betterTeams.util
Class StringUtil
java.lang.Object
com.booksaw.betterTeams.util.StringUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull String
setPlaceholders
(String text, Object... replacements) Replaces indexed placeholders in the provided text with the corresponding replacement values.static @NotNull String
setPlaceholders
(org.bukkit.entity.Player player, String text) static @NotNull String
setPlaceholders
(org.bukkit.OfflinePlayer player, String text, Object... replacements)
-
Field Details
-
EMPTY_STRING_ARRAY
-
-
Method Details
-
setPlaceholders
-
setPlaceholders
-
setPlaceholders
Replaces indexed placeholders in the provided text with the corresponding replacement values.Each placeholder in the text should follow the format {n}, where
n
is the zero-based index of the replacement value to insert. For example, "Hello, {0}!" with"world"
as the first replacement will result in"Hello, world!"
.If the
text
isnull
or empty, an empty string is returned. If no replacements are provided, the original text is returned unmodified.null
values in the replacement array are treated as empty strings.- Parameters:
text
- the text containing indexed placeholders like {0}, {1}, etc.replacements
- the values to insert into the placeholders- Returns:
- a new string with all placeholders replaced by their corresponding values
-