更多参考:
http://my.oschina.net/willclick/blog/32119
原文:
http://my.oschina.net/u/817904/blog/662928
这类位于 org.apache.commons.lang。
简单说一下都有哪些方法(具体参考源码文件):
random(int count) 生成一个长度为count的字符串,随机内容包含全部的编码。
randomAscii(int count) 生成一个长度为count的字符串,随机内容仅包含Ascii编码。
randomAlphabetic(int count) 生成一个长度为count的字符串,随机内容包含字母(含大小)的编码。
randomAlphanumeric(int count) 生成一个长度为count的字符串,随机内容包含字母(含大小)数字(0~9)的编码。
randomNumeric(int count) 生成一个长度为count的字符串,随机内容包含数字(0~9)的编码。
random(int count, char[] chars) 生成一个长度为count的字符串,随机内容包含chars。
random(int count, String chars) 生成一个长度为count的字符串,随机内容包含chars。
-------------------------
这里在说明一下生成汉字的方法,参考:utf-8汉字的编码范围
RandomStringUtils.random(20, 0x4e00, 0x9fa5, false,false)
分享到:
相关推荐
RandomStringUtils – 用于生成随机的字符串; SerializationUtils – 用于处理对象序列化,提供比一般Java序列化更高级的处理能力; StringEscapeUtils – 用于正确处理转义字符,产生正确的Java、JavaScript、HTML...
commons-lang.zip 关于commons-lang.jar应用的RandomStringUtils类
WordUtils RandomStringUtils StringUtils(部分实现)安装如果您在系统上设置了Go,请从命令行/终端内的GOPATH目录中输入以下内容: go get github.com/Masterminds/goutils如果您的系统上尚未安装Go,请按照的说明...
java Api 基础库,会把一些常用的方法和最佳实例进行封装 20180608 add pagination helper: val (offset, length) = Pagination.config(page) or Pagination.config(page, 20) 生成uid方法 String uid = uidService....
中文简介: commons-lang.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE.txtMETA-INF/NOTICE....
org.apache.commons.lang.RandomStringUtils.class org.apache.commons.lang.SerializationException.class org.apache.commons.lang.SerializationUtils.class org.apache.commons.lang.StringEscapeUtils.class...
org.apache.commons.lang.RandomStringUtils.class org.apache.commons.lang.SerializationException.class org.apache.commons.lang.SerializationUtils.class org.apache.commons.lang.StringEscapeUtils.class...