|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.apache.commons.lang.RandomStringUtils
Common random String manipulation routines.
Originally from the GenerationJava Core library.
| Field Summary | |
private static java.util.Random |
RANDOM
Random object used by random method. |
| Constructor Summary | |
RandomStringUtils()
RandomStringUtils instances should NOT be constructed in standard programming. |
|
| Method Summary | |
static java.lang.String |
random(int count)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
random(int count,
boolean letters,
boolean numbers)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
random(int count,
char[] set)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
random(int count,
int start,
int end,
boolean letters,
boolean numbers)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
random(int count,
int start,
int end,
boolean letters,
boolean numbers,
char[] set)
Creates a random string based on a variety of options. |
static java.lang.String |
random(int count,
java.lang.String set)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
randomAlphabetic(int count)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
randomAlphanumeric(int count)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
randomAscii(int count)
Creates a random string whose length is the number of characters specified. |
static java.lang.String |
randomNumeric(int count)
Creates a random string whose length is the number of characters specified. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final java.util.Random RANDOM
| Constructor Detail |
public RandomStringUtils()
RandomStringUtils.random(5);.
This constructor is public to permit tools that require a JavaBean instance
to operate.| Method Detail |
public static java.lang.String random(int count)
count - length of random string to createpublic static java.lang.String randomAscii(int count)
count - length of random string to createpublic static java.lang.String randomAlphabetic(int count)
count - length of random string to createpublic static java.lang.String randomAlphanumeric(int count)
count - length of random string to createpublic static java.lang.String randomNumeric(int count)
count - length of random string to create
public static java.lang.String random(int count,
boolean letters,
boolean numbers)
count - length of random string to createletters - if true, generated string will include
alphabetic charactersnumbers - if true, generatd string will include
numeric characters
public static java.lang.String random(int count,
int start,
int end,
boolean letters,
boolean numbers)
count - length of random string to createstart - int position in set of chars to start atend - int position in set of chars to end beforeletters - if true, generated string will include
alphabetic charactersnumbers - if true, generatd string will include
numeric characters
public static java.lang.String random(int count,
int start,
int end,
boolean letters,
boolean numbers,
char[] set)
If set is not null, characters between start and end are chosen.
count - int length of random string to createstart - int position in set of chars to start atend - int position in set of chars to end beforeletters - boolean only allow letters?numbers - boolean only allow numbers?set - char[] set of chars to choose randoms from.
If null, then it will use the set of all chars.ArrayIndexOutOfBoundsException - if there are not (end - start) + 1
characters in the set array.
public static java.lang.String random(int count,
java.lang.String set)
count - int length of random string to createset - String containing the set of characters to use
public static java.lang.String random(int count,
char[] set)
count - int length of random string to createset - character array containing the set of characters to use
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||