<% str = "how_are_you? are you feeling good?" %>
<%= str.split(/\s+/).each{ |word| word.capitalize! }.join(' ') %><br>
<%= str.gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase }%><br>
<%= str.titleize %><br>
<%= str.chars.upcase.to_s %>
<%= str.split(/\s+/).each{ |word| word.capitalize! }.join(' ') %><br>
<%= str.gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase }%><br>
<%= str.titleize %><br>
<%= str.chars.upcase.to_s %>
Output :
How_are_you? Are You Feeling Good?
How_are_you? Are You Feeling Good?
How Are You? Are You Feeling Good?
HOW_ARE_YOU? ARE YOU FEELING GOOD?
How_are_you? Are You Feeling Good?
How Are You? Are You Feeling Good?
HOW_ARE_YOU? ARE YOU FEELING GOOD?
No comments:
Post a Comment