turn array of strings into a sentence with ruby -


so need turn array of strings sentence, capitalize first word , add period @ end. have looked everywhere , found bits , pieces nothing specific problem.

what tried far:

array1 = ["this", "is", "my", "first", "post"]   def sentence_maker (array)  array.join(' ')  end 

it makes sentence can't figure out how make first word capitalized while keeping others in lower case , add "." @ end of sentence. appreciated.

you below :

array1 = ["this", "is", "my", "first", "post"]   def sentence_maker (array)   array.join(' ').capitalize << "." end  sentence_maker(array1) # => "this first post." 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -