消除我特牛
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

812 B

template

Return a random string matching the given template.

// usage
chance.template('{AA####}')
=> 'ZQ7803'
chance.template('{Aa}-{##}')
=> 'Vr-78'
chance.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