Class Util
- java.lang.Object
-
- com.github.curiousoddman.rgxgen.util.Util
-
public final class Util extends Object
Utility methods collection
-
-
Field Summary
Fields Modifier and Type Field Description static BigIntegerBIG_INTEGER_TWOstatic Character[]ZERO_LENGTH_CHARACTER_ARRAY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigIntegercountCaseInsensitiveVariations(CharSequence value)Count number of variation of words in case insensitive manner.static OptionalIntindexOfNextCaseSensitiveCharacter(CharSequence text, int startIndex)Finds next case sensitive character.static StringrandomlyChangeCase(Random rnd, CharSequence input)Randomly change case for the letters in a stringstatic Stringrepeat_char(char c, int times)Repeats text multiple timesstatic Character[]stringToChars(CharSequence str)
-
-
-
Field Detail
-
ZERO_LENGTH_CHARACTER_ARRAY
public static final Character[] ZERO_LENGTH_CHARACTER_ARRAY
-
BIG_INTEGER_TWO
public static final BigInteger BIG_INTEGER_TWO
-
-
Method Detail
-
stringToChars
public static Character[] stringToChars(CharSequence str)
-
repeat_char
public static String repeat_char(char c, int times)
Repeats text multiple times- Parameters:
c- character to repeattimes- number of times. Values less or equal to zero will result in empty string- Returns:
- text repeated multiple times
-
randomlyChangeCase
public static String randomlyChangeCase(Random rnd, CharSequence input)
Randomly change case for the letters in a string- Parameters:
rnd- random to be usedinput- input string to randomize- Returns:
- string with random characters changed case.
-
countCaseInsensitiveVariations
public static BigInteger countCaseInsensitiveVariations(CharSequence value)
Count number of variation of words in case insensitive manner. For example for word "a" - there are 2 variation ("a" and "A"). For word "1a" - there are also 2 variations ("1a" and "1A") For word "AB" - there are 4 variations: ("ab", "aB", "Ab", "BB")- Parameters:
value- word to calculate variations- Returns:
- number of variations.
-
indexOfNextCaseSensitiveCharacter
public static OptionalInt indexOfNextCaseSensitiveCharacter(CharSequence text, int startIndex)
Finds next case sensitive character. Case sensitive character is either lower-case or upper-case character.- Parameters:
text- text to be analyzedstartIndex- start search from index.- Returns:
- index of next case sensitive character or
emptyif no such character present
-
-