Class StringUtilRt
- java.lang.Object
-
- jetbrains.buildServer.vcs.patches.diff.StringUtilRt
-
public class StringUtilRt extends Object
Stripped-down version ofcom.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 Summary
Constructors Constructor Description StringUtilRt()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancharsEqualIgnoreCase(char a, char b)static CharSequenceconvertLineSeparators(CharSequence text, String newSeparator)static StringconvertLineSeparators(String text)Converts line separators to"\n"static StringconvertLineSeparators(String text, boolean keepCarriageReturn)static StringconvertLineSeparators(String text, String newSeparator)static StringconvertLineSeparators(String text, String newSeparator, int[] offsetsToKeep)static StringconvertLineSeparators(String text, String newSeparator, int[] offsetsToKeep, boolean keepCarriageReturn)static booleanendsWith(CharSequence text, CharSequence suffix)static booleanendsWithChar(CharSequence s, char suffix)static booleanendsWithIgnoreCase(CharSequence text, CharSequence suffix)static booleanequal(CharSequence s1, CharSequence s2, boolean caseSensitive)static StringformatFileSize(long fileSize)static StringformatFileSize(long fileSize, String unitSeparator)static StringgetShortName(Class aClass)static StringgetShortName(String fqName)static StringgetShortName(String fqName, char separator)static booleanisEmpty(CharSequence cs)static booleanisEmptyOrSpaces(CharSequence s)static booleanisQuotedString(String s)static intlastIndexOf(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.static StringnotNullize(String s)static StringnotNullize(String s, String defaultValue)static doubleparseDouble(String string, double defaultValue)static intparseInt(String string, int defaultValue)static longparseLong(String string, long defaultValue)static List<String>splitHonorQuotes(String s, char separator)static booleanstartsWithIgnoreCase(String str, String prefix)static chartoLowerCase(char a)static chartoUpperCase(char a)static StringunquoteString(String s)static StringunquoteString(String s, char quotationChar)
-
-
-
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 CharSequence convertLineSeparators(@NotNull CharSequence 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)
-
endsWithChar
public static boolean endsWithChar(@Nullable CharSequence s, char suffix)
-
endsWith
public static boolean endsWith(@NotNull CharSequence text, @NotNull CharSequence 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 textc- target symbol which last occurrence we want to checkstart- 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;
-1otherwise
-
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, @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)
-
-