Class StringUtilRt


  • public class StringUtilRt
    extends Object
    Stripped-down version of com.intellij.openapi.util.text.StringUtil. Intended to use by external (out-of-IDE-process) runners and helpers so it should not contain any library dependencies.
    Since:
    12.0
    • Constructor Detail

      • StringUtilRt

        public StringUtilRt()
    • Method Detail

      • equal

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

        public static boolean charsEqualIgnoreCase​(char a,
                                                   char b)
      • toUpperCase

        public static char toUpperCase​(char a)
      • toLowerCase

        public static char toLowerCase​(char a)
      • convertLineSeparators

        @NotNull
        public static String convertLineSeparators​(@NotNull
                                                   String text)
        Converts line separators to "\n"
      • convertLineSeparators

        @NotNull
        public static String convertLineSeparators​(@NotNull
                                                   String text,
                                                   boolean keepCarriageReturn)
      • convertLineSeparators

        @NotNull
        public static String convertLineSeparators​(@NotNull
                                                   String text,
                                                   @NotNull
                                                   String newSeparator)
      • convertLineSeparators

        @NotNull
        public static String convertLineSeparators​(@NotNull
                                                   String text,
                                                   @NotNull
                                                   String newSeparator,
                                                   @Nullable
                                                   int[] offsetsToKeep)
      • convertLineSeparators

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

        public static int parseInt​(@Nullable
                                   String string,
                                   int defaultValue)
      • parseLong

        public static long parseLong​(@Nullable
                                     String string,
                                     long defaultValue)
      • parseDouble

        public static double parseDouble​(@Nullable
                                         String string,
                                         double defaultValue)
      • getShortName

        @NotNull
        public static String getShortName​(@NotNull
                                          Class aClass)
      • getShortName

        @NotNull
        public static String getShortName​(@NotNull
                                          String fqName)
      • getShortName

        @NotNull
        public static String getShortName​(@NotNull
                                          String fqName,
                                          char separator)
      • endsWithChar

        public static boolean endsWithChar​(@Nullable
                                           CharSequence s,
                                           char suffix)
      • startsWithIgnoreCase

        public static boolean startsWithIgnoreCase​(@NotNull
                                                   String str,
                                                   @NotNull
                                                   String prefix)
      • endsWithIgnoreCase

        public static boolean endsWithIgnoreCase​(@NotNull
                                                 CharSequence text,
                                                 @NotNull
                                                 CharSequence suffix)
      • lastIndexOf

        public static int lastIndexOf​(@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

        public static boolean isEmpty​(@Nullable
                                      CharSequence cs)
      • isEmptyOrSpaces

        public static boolean isEmptyOrSpaces​(@Nullable
                                              CharSequence s)
      • notNullize

        @NotNull
        public static String notNullize​(@Nullable
                                        String s)
      • notNullize

        @NotNull
        public static String notNullize​(@Nullable
                                        String s,
                                        @NotNull
                                        String defaultValue)
      • splitHonorQuotes

        @NotNull
        public static List<String> splitHonorQuotes​(@NotNull
                                                    String s,
                                                    char separator)
      • formatFileSize

        @NotNull
        public static String formatFileSize​(long fileSize)
      • formatFileSize

        @NotNull
        public static String formatFileSize​(long fileSize,
                                            @NotNull
                                            String unitSeparator)
      • isQuotedString

        public static boolean isQuotedString​(@NotNull
                                             String s)
      • unquoteString

        @NotNull
        public static String unquoteString​(@NotNull
                                           String s)
      • unquoteString

        @NotNull
        public static String unquoteString​(@NotNull
                                           String s,
                                           char quotationChar)