Sha256: 7b440dbb74cfb38c15cf9b1bf40b3386984c4e01e938634aea40c229b33582ea

Contents?: true

Size: 588 Bytes

Versions: 4

Compression:

Stored size: 588 Bytes

Contents

# class String
#
#   # Returns a copy of a string with the first letter of each word capitalized.
#   # @return [String]
#   def titleize()
#     return self.split(" ")
#                .map(&:capitalize!)
#                .join(" ")
#   end
#
#   # @return [String]
#   def titleize2(string)
#     words = self.split(" ")
#     skips = ["and", "of", "the", "in", "to", "over", "an", "a"]
#     words.each do |word|
#       if word == words[0] || !skips.include?(word)
#         element.capitalize!
#       end
#     end
#     answer = array.join(" ")
#     return answer
#   end
#
# end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coolkit-0.2.2 lib/coolkit/string/titleize.rb
coolkit-0.2.1 lib/coolkit/string/titleize.rb
coolkit-0.2.0 lib/coolkit/string/titleize.rb
coolkit-0.1.0 lib/coolkit/string/titleize.rb