Class StrKit

java.lang.Object
com.iohao.net.common.kit.StrKit

public final class StrKit extends Object
String manipulation utilities.
Author:
渔民小镇
date:
2022-05-28
  • Method Details

    • firstCharToUpperCase

      public static String firstCharToUpperCase(String value)
      Convert the first character of the string to upper case.
      Parameters:
      value - the source string
      Returns:
      the string with its first character converted to upper case, or the original string if already upper case
    • firstCharToLowerCase

      public static String firstCharToLowerCase(String value)
      Convert the first character of the string to lower case.
      Parameters:
      value - the source string
      Returns:
      the string with its first character converted to lower case, or the original string if already lower case
    • isEmpty

      public static boolean isEmpty(String str)
      Check whether the string is null or blank (whitespace only).
      Parameters:
      str - the string to check
      Returns:
      true if the string is null or blank
    • isEmpty

      public static boolean isEmpty(CharSequence str)
      Check whether the character sequence is null or empty.
      Parameters:
      str - the character sequence to check
      Returns:
      true if the sequence is null or empty
    • isNotEmpty

      public static boolean isNotEmpty(String str)
      Check whether the string is neither null nor blank.
      Parameters:
      str - the string to check
      Returns:
      true if the string is not null and not blank
    • format

      public static String format(@NonNull String template, @NonNull Map<?,?> map)
      Replace {key} placeholders in the template with corresponding map values.

      Entries whose value is null are skipped. All occurrences of each placeholder are replaced.

      Parameters:
      template - the template string containing {key} placeholders
      map - the key-value pairs used for substitution
      Returns:
      the formatted string with placeholders replaced