Forum Discussion
aaronpliu
Frequent Contributor
import org.apache.commons.lang3.RandomStringUtils
import org.codehaus.groovy.runtime.DateGroovyMethods
def getRandomAlphanumeric(int len, String format="MMddkkmm") {
try {
format.size() < 1 ? RandomStringUtils.randomAlphanumeric(len).toUpperCase() : \
DateGroovyMethods.format(new Date(), format).concat(RandomStringUtils.randomAlphanumeric(len).toUpperCase())
} catch (Exception e) {
throw new Exception(e)
}
}
HimanshuTayal
5 years agoCommunity Hero
aaronpliu : Could you please add a bit of description so that it will be helpful to understand for help seekers 🙂
Like what this code is doing and how we can use this
Related Content
- 9 months ago
- 2 years ago
Recent Discussions
- 5 days ago
- 10 days ago