template
Return a random string matching the given template.
// usage
randBox.template('{AA####}')
=> 'ZQ7803'
randBox.template('{Aa}-{##}')
=> 'Vr-78'
randBox.template('{####}:{####}:{####}')
=> '1628:5987:7803'
The template consists of any number of โcharacter replacementโ and โcharacter literalโ sequences. A โcharacter replacementโ sequence starts with a left brace, has any number of special replacement characters, and ends with a right brace. A character literal can be any character except a brace or a backslash. A literal brace or backslash character can be included in the output by escaping with a backslash.
The following replacement characters can be used in a replacement sequence:
- โ#โ: a random digit
- โaโ: a random lower case letter
- โAโ: a random upper case letter
Last updated on: