Reputation: 1580
Ruby is not my normal language, and I'm struggling to get the following to work.
I'm just working with an array.
irb(main):54232:0> contact_data
=> ["3521", "[email protected]", "ADA JONES SMITH"]
irb(main):54226:0> contact_data[2].split.first.to_s.camelize
=> "ADA"
Why? and how do I convert the string to CamelCase?
Thank you.
Upvotes: 1
Views: 461
Reputation: 12427
The problem is that contact_data[2].split.first
is already completely upcase: "ADA"
, and the method String#camelize
works on lowercase strings.
You should make it lowercase first:
contact_data[2].split.first.to_s.downcase.camelize
Upvotes: 1