Scalar functions
characterString
Commentary
added in 0.1.13
Generates character strings composed of only alpha characters. Specify the length with n.
Examples
Generating character strings
{
"_gen": "characterString",
"case": "mixed",
"n": 8
}
[
"ArnQdPAA",
"iGueWIlz",
"ORArZvMg",
"tYMKsHHV",
"GLPKFfVD"
]
Generating unique strings
To make every character in the generated string unique, set unique to true.
{
"_gen": "characterString",
"case": "upper",
"unique": true,
"n": 5
}
[
"WKLMB",
"VXCAS",
"HNYIL",
"CGTFS",
"EQUZK"
]
Capping unique character counts
When unique is set to true and n is set to a value higher than the number of candidate characters, it will generate the max available characters and then stop.
In this example with unique set to true and case set to lower, there are 26 candidate characters (the standard alphabet). Since n is set to 50, it will only generate strings of 26 characters.
{
"_gen": "characterString",
"case": "lower",
"unique": true,
"n": 50
}
[
"wklmbfqdpnjhiytesgocxvurza",
"vxcaslugjpkqizoebwdhrntmfy",
"hnyilxqsvaeutwzpjcmrdfgbko",
"cgtfsqbijzldhopremynxuwkav",
"equzkwxhptscjiambdfgoynvlr"
]
Specification
JSON schema
{
"type": "object",
"properties": {
"n": {
"oneOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"unique": {
"type": "boolean"
},
"case": {
"type": "string",
"enum": [
"lower",
"upper",
"mixed"
]
}
},
"required": [
"n",
"case"
]
}