Class StringUtilRt

java.lang.Object
com.intellij.openapi.util.text.StringUtilRt
Direct Known Subclasses:
StringUtil

public class StringUtilRt extends Object
Stripped-down version of StringUtil. Intended to use by external (out-of-IDE-process) runners and helpers so it should not contain any library dependencies.
  • Constructor Details

    • StringUtilRt

      public StringUtilRt()
  • Method Details

    • equal

      @Contract("null,!null,_ -> false; !null,null,_ -> false; null,null,_ -> true") public static boolean equal(@Nullable @Nullable CharSequence s1, @Nullable @Nullable CharSequence s2, boolean caseSensitive)
    • charsEqualIgnoreCase

      @Contract(pure=true) public static boolean charsEqualIgnoreCase(char a, char b)
    • toUpperCase

      @Contract(pure=true) public static char toUpperCase(char a)
    • toLowerCase

      @Contract(pure=true) public static char toLowerCase(char a)
    • convertLineSeparators

      @NotNull @Contract(pure=true) public static @NotNull String convertLineSeparators(@NotNull @NotNull String text)
      Converts line separators to "\n"
    • convertLineSeparators

      @NotNull @Contract(pure=true) public static @NotNull String convertLineSeparators(@NotNull @NotNull String text, boolean keepCarriageReturn)
    • convertLineSeparators

      @NotNull @Contract(pure=true) public static @NotNull String convertLineSeparators(@NotNull @NotNull String text, @NotNull @NotNull String newSeparator)
    • convertLineSeparators

      @NotNull @Contract(pure=true) public static @NotNull CharSequence convertLineSeparators(@NotNull @NotNull CharSequence text, @NotNull @NotNull String newSeparator)
    • convertLineSeparators

      @NotNull public static @NotNull String convertLineSeparators(@NotNull @NotNull String text, @NotNull @NotNull String newSeparator, @Nullable @org.jetbrains.annotations.Nullable int[] offsetsToKeep)
    • convertLineSeparators

      @NotNull public static @NotNull String convertLineSeparators(@NotNull @NotNull String text, @NotNull @NotNull String newSeparator, @Nullable @org.jetbrains.annotations.Nullable int[] offsetsToKeep, boolean keepCarriageReturn)
    • parseInt

      @Contract(pure=true) public static int parseInt(@Nullable @Nullable String string, int defaultValue)
    • parseLong

      @Contract(pure=true) public static long parseLong(@Nullable @Nullable String string, long defaultValue)
    • parseDouble

      @Contract(pure=true) public static double parseDouble(@Nullable @Nullable String string, double defaultValue)
    • getShortName

      @NotNull @Contract(pure=true) public static @NotNull String getShortName(@NotNull @NotNull Class<?> aClass)
    • getShortName

      @NotNull @Contract(pure=true) public static @NotNull String getShortName(@NotNull @NotNull String fqName)
    • getShortName

      @NotNull @Contract(pure=true) public static @NotNull String getShortName(@NotNull @NotNull String fqName, char separator)
    • endsWithChar

      @Contract(pure=true) public static boolean endsWithChar(@Nullable @Nullable CharSequence s, char suffix)
    • endsWith

      @Contract(pure=true) public static boolean endsWith(@NotNull @NotNull CharSequence text, @NotNull @NotNull CharSequence suffix)
    • startsWithIgnoreCase

      @Contract(pure=true) public static boolean startsWithIgnoreCase(@NotNull @NotNull String str, @NotNull @NotNull String prefix)
    • startsWithIgnoreCase

      @Contract(pure=true) public static boolean startsWithIgnoreCase(@NotNull @NotNull String str, int startOffset, @NotNull @NotNull String prefix)
    • endsWithIgnoreCase

      @Contract(pure=true) public static boolean endsWithIgnoreCase(@NotNull @NotNull CharSequence text, @NotNull @NotNull CharSequence suffix)
    • lastIndexOf

      @Contract(pure=true) public static int lastIndexOf(@NotNull @NotNull CharSequence s, char c, int start, int end)
      Allows to retrieve index of last occurrence of the given symbols at [start; end) sub-sequence of the given text.
      Parameters:
      s - target text
      c - target symbol which last occurrence we want to check
      start - start offset of the target text (inclusive)
      end - end offset of the target text (exclusive)
      Returns:
      index of the last occurrence of the given symbol at the target sub-sequence of the given text if any; -1 otherwise
    • isEmpty

      @Contract(value="null -> true", pure=true) public static boolean isEmpty(@Nullable @Nullable CharSequence cs)
    • isEmptyOrSpaces

      @Contract(value="null -> true", pure=true) public static boolean isEmptyOrSpaces(@Nullable @Nullable CharSequence s)
    • notNullize

      @NotNull @Contract(pure=true) public static @NotNull String notNullize(@Nullable @Nullable String s)
    • notNullize

      @NotNull @Contract(pure=true) public static @NotNull String notNullize(@Nullable @Nullable String s, @NotNull @NotNull String defaultValue)
    • splitHonorQuotes

      @NotNull @Contract(pure=true) public static @NotNull List<String> splitHonorQuotes(@NotNull @NotNull String s, char separator)
    • formatFileSize

      @NotNull @Contract(pure=true) public static @NotNull String formatFileSize(long fileSize)
    • formatFileSize

      @NotNull @Contract(pure=true) public static @NotNull String formatFileSize(long fileSize, @NotNull @NotNull String unitSeparator)
    • formatFileSize

      @NotNull @Contract(pure=true) public static @NotNull String formatFileSize(long fileSize, @NotNull @NotNull String unitSeparator, int rank)
      Parameters:
      fileSize - - size of the file in bytes
      unitSeparator - - separator inserted between value and unit
      rank - - preferred rank. 0 - bytes, 1 - kilobytes, ..., 6 - exabytes. If less than 0 then picked automatically
      Returns:
      string with formatted file size
    • rankForFileSize

      @Contract(pure=true) public static int rankForFileSize(long fileSize)
    • isQuotedString

      @Contract(pure=true) public static boolean isQuotedString(@NotNull @NotNull String s)
      Returns:
      true if the string starts and ends with quote (") or apostrophe (')
    • unquoteString

      @NotNull @Contract(pure=true) public static @NotNull String unquoteString(@NotNull @NotNull String s)
    • unquoteString

      @NotNull @Contract(pure=true) public static @NotNull String unquoteString(@NotNull @NotNull String s, char quotationChar)
    • startsWith

      @Contract(pure=true) public static boolean startsWith(@NotNull @NotNull CharSequence text, @NotNull @NotNull CharSequence prefix)
    • stringHashCodeInsensitive

      @Contract(pure=true) public static int stringHashCodeInsensitive(@NotNull @NotNull CharSequence chars)
    • stringHashCodeInsensitive

      @Contract(pure=true) public static int stringHashCodeInsensitive(@NotNull @NotNull CharSequence chars, int from, int to)
    • stringHashCodeInsensitive

      @Contract(pure=true) public static int stringHashCodeInsensitive(@NotNull @NotNull CharSequence chars, int from, int to, int prefixHash)