Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby letters order in string

def order_of_letters(text)
    sorted = text.chars.sort.join #use only this one if you want just sorted arr of letters
    result = []
    text.split('').each do |symbol|
      result << sorted.index(symbol).to_i
    end
    result
end
 
PREVIOUS NEXT
Tagged: #ruby #letters #order #string
ADD COMMENT
Topic
Name
4+7 =