Method: Rex::Text.to_mixed_case_array
- Defined in:
- lib/rex/text.rb
.to_mixed_case_array(str) ⇒ Array<String>
Takes a string, and returns an array of all mixed case versions.
893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'lib/rex/text.rb', line 893 def self.to_mixed_case_array(str) letters = [] str.scan(/./).each { |l| letters << [l.downcase, l.upcase] } coords = [] (1 << str.size).times { |i| coords << ("%0#{str.size}b" % i) } mixed = [] coords.each do |coord| c = coord.scan(/./).map {|x| x.to_i} this_str = "" c.each_with_index { |d,i| this_str << letters[i][d] } mixed << this_str end return mixed.uniq end |