Skip to content
Advertisement

Tag: alphanumeric

How to determine if a String has non-alphanumeric characters?

I need a method that can tell me if a String has non alphanumeric characters. For example if the String is “abcdef?” or “abcdefà”, the method must return true. Answer Using Apache Commons Lang: Alternativly iterate over String’s characters and check with: You’ve still one problem left: Your example string “abcdefà” is alphanumeric, since à is a letter. But I

How to generate a random alpha-numeric string

I’ve been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would “likely” be unique over 500K+ generation (my needs don’t really require anything much more sophisticated). Ideally, I would be able to specify a length depending on my uniqueness needs. For example, a

Advertisement