I'm sure someone will inevitably suggest a better method, but the following
would do the trick:
1) Create UID with UIDUtil.createUID()
2) Strip '-' symbols / Strip vowels
3) Truncate to 12 characters (if there weren't enough after stripping
vowels, just repeat steps 1 and 2 and append to current string and truncate
again)
4) reintroduce '-' where needed in pattern you indicated.


Brendan



On Mon, Jan 5, 2009 at 4:19 PM, anuj181 <[email protected]> wrote:

>   Hi
> I need to work on a piece of code in which whenever user clicks on the
> button , the code should generate random 12 character key having all
> caps and no vowels in the format of XXX-XXX-XXX-XXX. Can anybody guide
> me in this direction. Is there any built in function for that or do I
> have to use my own logic for random generation in this specific case.
> Any help will be appreciated.
> Thanks
> Anuj
>
>  
>



-- 
Brendan Meutzner
http://www.meutzner.com/blog/

Reply via email to