Package com.kamikazejam.kamicommon.util
Class Txt
java.lang.Object
com.kamikazejam.kamicommon.util.Txt
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull String
camelSplit
(String string) static <T> @NotNull List
<T> getFiltered
(@NotNull Iterable<T> elements, @NotNull Predicate<T> predicate) static <T> @NotNull List
<T> getFiltered
(T @NotNull [] elements, @NotNull Predicate<T> predicate) static @NotNull String
getItemName
(@Nullable ItemStack itemStack) static @NotNull String
getItemName
(@Nullable ItemStack itemStack, @NotNull String defaultName) static @NotNull String
getMaterialName
(@NotNull Material material) getNicedEnum
(T enumObject) getNicedEnum
(T enumObject, String glue) static @NotNull String
getNicedEnumString
(@NotNull String str) static @NotNull String
getNicedEnumString
(@NotNull String str, String glue) getStartsWithIgnoreCase
(@NotNull Iterable<String> elements, String prefix) getStartsWithIgnoreCase
(String @NotNull [] elements, String prefix) static @NotNull String
static @NotNull String
static @NotNull String
implode
(@NotNull Collection<?> coll, String glue) static @NotNull String
implode
(@NotNull Collection<?> coll, String glue, @Nullable String format) static @NotNull String
implodeCommaAndDot
(@NotNull Collection<?> objects, @Nullable String format, String comma, String and, String dot) static boolean
static String
lowerCaseFirst
(String string) static String
removeSmartQuotes
(String string) static @NotNull String
Formats a given title to be centered in a titleized line.
Titleized lines can be configured inTxt.Config
They feature the centered in additional 'titleized' line characters.static @NotNull String
titleizedPageTitle
(@NotNull String title, int pageNum, int pageCount, @NotNull List<String> args) Forms a page title using , and , and then passes it totitleize(String)
.
Default format is configured inTxt.Config.pageTitleFormat
and looks like:tokenizeArguments
(@NotNull String str) static String
upperCaseFirst
(String string)
-
Field Details
-
PATTERN_WHITESPACE
-
PATTERN_NEWLINE
-
millisPerSecond
public static final long millisPerSecond- See Also:
-
millisPerMinute
public static final long millisPerMinute- See Also:
-
millisPerHour
public static final long millisPerHour- See Also:
-
millisPerDay
public static final long millisPerDay- See Also:
-
millisPerWeek
public static final long millisPerWeek- See Also:
-
millisPerMonth
public static final long millisPerMonth- See Also:
-
millisPerYear
public static final long millisPerYear- See Also:
-
vowel
-
PATTERN_ENUM_SPLIT
-
-
Constructor Details
-
Txt
public Txt()
-
-
Method Details
-
upperCaseFirst
-
lowerCaseFirst
-
isVowel
-
aan
-
implode
-
implode
-
implode
@NotNull public static @NotNull String implode(@NotNull @NotNull Collection<?> coll, String glue, @Nullable @Nullable String format) -
implode
-
implodeCommaAndDot
-
camelSplit
-
getFiltered
-
getFiltered
-
getStartsWithIgnoreCase
-
getStartsWithIgnoreCase
-
getNicedEnumString
-
getNicedEnumString
-
getNicedEnum
-
getNicedEnum
-
getMaterialName
-
getItemName
- Returns:
- The name of the item, or a default name (
getItemName(ItemStack, String)
) if the item is null or empty.
-
getItemName
@NotNull public static @NotNull String getItemName(@Nullable @Nullable ItemStack itemStack, @NotNull @NotNull String defaultName) - Returns:
- The name of the item, or the supplied default name if the item is null or empty.
-
tokenizeArguments
-
removeSmartQuotes
-
titleize
Formats a given title to be centered in a titleized line.
Titleized lines can be configured inTxt.Config
They feature the centered in additional 'titleized' line characters.- Parameters:
title
- The unformatted title, which will be titleized.- Returns:
- The titleized page title String.
-
titleizedPageTitle
@NotNull public static @NotNull String titleizedPageTitle(@NotNull @NotNull String title, int pageNum, int pageCount, @NotNull @NotNull List<String> args) Forms a page title using , and , and then passes it totitleize(String)
.
Default format is configured inTxt.Config.pageTitleFormat
and looks like:- Parameters:
title
- The unformatted title, which will be titleized.pageNum
- The current page number, 1-based (e.g. 1 for the first page).pageCount
- The total number of pages.- Returns:
- The titleized page title String.
-