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

Inserting and Moving elements inside Ruby Array

Remove duplicates from a JavaScript Array

Sending Binary Data over the Network with Json