1.0.4 • Published 2 years ago
5x-random-str v1.0.4
introduction
This is a randomly generated string project that can be used to generate passwords and/or strings of any length. It also allows customization of the random content range and provides the flexibility to set the delimiter positions and symbols without any specific rules or restrictions.
这是一个随机生成的字符串项目,可用于生成任何长度的密码和/或字符串。它还允许自定义随机内容范围,并提供设置分隔符位置和符号的灵活性,而无需任何特定规则或限制。
install
npm install 5x-random-strimport
//commonjs
const rs5x = require("5x-random-str")
//es6+
import * as rs5x from "5x-random-str";
//iife
<script src="https://unpkg.com/5x-random-str/index.js"></script>
const rs5x = window["5x-random-str"];simple default
rs5x.randomStr()#result
a9ZOLl.@[7@K}RSAuse Number
rs5x.Number(12)#result
280127374882use ABC
rs5x.ABC(12)#result
ZKVWGZYUAZSFuse abc
rs5x.abc(12)#result
gcdglealiwyvuse ABC_abc
rs5x.ABC_abc(12)#result
WbMaduuxDgfSuse ABC_abc_123
rs5x.ABC_abc_123()#result
kPo4gsk5KAC6GoN5use strongPasswd
rs5x.strongPasswd(12)#result
#FIKz@bfMoHpuse superPasswd
rs5x.superPasswd()#result
b,[NoxLTOV-c_1wTuse length,use default chats,use upperCase
rs5x.randomStr(20, [], true)#result
$C)5D})MBU*?U!~@.W!$use chars array const
rs5x.randomStr(6, [rs5x.CHARS.ABC_XYZ,rs5x.CHARS.abc_xyz], true)#result
CGZUYFuse custom chars
rs5x.randomStr(1, ["甲乙丙丁戊己庚辛壬癸","尨"], true)+rs5x.randomStr(1, ["子丑寅卯辰巳午未申酉戌亥"], true)#result
辛卯use more chars
rs5x.randomStr(32, [
rs5x.CHARS["+.(~)[]?}|{][,-"],
rs5x.CHARS["!@#$%^&*()_"]], true)#result
^.!)]-!,!{)&])(?[[#|.?]%~]}?}]])use separator
rs5x.randomStr(32, [
rs5x.CHARS.ABC_XYZ,
rs5x.CHARS.abc_xyz,
rs5x.CHARS["1234567890"]], false,"-")#result
6E33-cs8K-mGBW-kg0V-toxp-dFmf-isOB-zShfuse separator step
rs5x.randomStr(32, [
rs5x.CHARS.ABC_XYZ,
rs5x.CHARS.abc_xyz,
rs5x.CHARS["1234567890"]], true,"__",5)#result
BATL6__LVCEU__OEKGY__AFZBT__UDZCK__PIR3G__B1use separator steps
rs5x.randomStr(32, [
rs5x.CHARS.ABC_XYZ,
rs5x.CHARS.abc_xyz,
rs5x.CHARS["1234567890"]], false,"-",[4,4,4,8])#result
xFWh-G1N8-lYcf-skfGREvM-MoKOo63d0PZK