Package com.booksaw.betterTeams.util
Class StringUtil
java.lang.Object
com.booksaw.betterTeams.util.StringUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StringsetPlaceholders(String text, Object... replacements) Replaces indexed placeholders in the provided text with the corresponding replacement values.static @NotNull StringsetPlaceholders(org.bukkit.entity.Player player, String text) static @NotNull StringsetPlaceholders(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
nis 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
textisnullor empty, an empty string is returned. If no replacements are provided, the original text is returned unmodified.nullvalues 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
-