jeudi 29 septembre 2016

How do I generate a random string without certain characters?

I’m using Java 6 with Apache Commons. I have this code for generating a random string

        temporaryPassword = RandomStringUtils.random(TEMPORARY_PASSWORD_LENGTH,
                                                     true,
                                                     true);

My question is, how can I generate this random string without certain characters? For instance I wish to generate the string without zeroes and ones and “i”s and “o”s. There might be some others but if we can solve the problem with the characters I list, then we’re good.




Aucun commentaire:

Enregistrer un commentaire