randomString
def randomString = { length = 10 ->
String alphabet = (('a'..'z')+ ('A'..'Z') + ('0'..'9')).join()
String randomString = new Random().with {
(1..length).collect { alphabet[ nextInt( alphabet.length() ) ] }.join()
}
return randomString
}
Gets a random string of a specified length. Default is 10.
Example
"dev_name": "randomString(5)"
For more information:
concat
escape
ifelse
Was this helpful?