2010-01-20 41 views
1

任何人都可以給我一個技術手來生成滿足一定限制的字符串。如何生成滿足一些限制的字符串?

例如,說我需要生成字符串s和t,使得

 length(s) < length(t) 
     length(t) > 12 
     t contains at least 3 capital letters 
and s contains a 2 

而且我不是指這個特殊的例子,但一些通用的技術來生成滿足一定條件字符串。

+1

相關:http://stackoverflow.com/questions/205411/random-string-that-matches-a-regexp – moonshadow 2010-01-20 11:03:56

+0

聞起來像功課,這是功課? – 2010-01-20 11:06:33

+0

相關,從相同的用戶:http://stackoverflow.com/questions/2100803/how-can-i-generate-integers-that-satisfy-some-restrictions – 2010-01-20 11:08:47

回答