Method: Rex::Text.to_mixed_case_array
- Defined in:
- lib/rex/text/randomize.rb
.to_mixed_case_array(str) ⇒ Array<String>
Takes a string, and returns an array of all mixed case versions.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rex/text/randomize.rb', line 37 def self.to_mixed_case_array(str) letters = str.each_char.map { |l| [l.downcase, l.upcase] } (1 << str.size).times.map do |i| this_str = "" ("%0#{str.size}b" % i).each_char.map(&:to_i).each_with_index do |d,i| this_str << letters[i][d] end this_str end.uniq end |