我可以使用 Apache 的 common-text RandomStringGenerator
生成随机字母数字字符串(数字和小写/大写字母)?
最佳答案
是的,使用以下代码:
import static org.apache.commons.text.CharacterPredicates.DIGITS;
import static org.apache.commons.text.CharacterPredicates.LETTERS;
// ...
RandomStringGenerator generator = new RandomStringGenerator.Builder()
.withinRange('0', 'z')
.filteredBy(LETTERS, DIGITS)
.build();
关于java - 用于生成字母数字字符串的 RandomStringGenerator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44947976/