Generate abbreviations from string

Generate abbreviations from string

>> str = "nishant nigam"
=> "nishant nigam"
>> str.split(" ").map {|name| name[0].chr }.join.upcase
=> "NN"

Comments

Popular posts from this blog

Interview Question on Ruby on Rails

Inserting and Moving elements inside Ruby Array