Class StringUtil

java.lang.Object
com.booksaw.betterTeams.util.StringUtil

public class StringUtil extends Object
  • Field Details

    • EMPTY_STRING_ARRAY

      public static final String[] EMPTY_STRING_ARRAY
  • Method Details

    • setPlaceholders

      @NotNull public static @NotNull String setPlaceholders(org.bukkit.entity.Player player, String text)
    • setPlaceholders

      @NotNull public static @NotNull String setPlaceholders(org.bukkit.OfflinePlayer player, String text, Object... replacements)
    • setPlaceholders

      @NotNull public static @NotNull String setPlaceholders(String text, Object... replacements)
      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 is null 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