The Hashtag Generator

From codewars.com by Edxael  (that’s me)

Description:

The marketing team are spending way too much time typing in hashtags.
Let’s help them with out own Hashtag Generator!

Here’s the deal:

  • If the final result is longer than 140 chars it must return false.
  • If the input is a empty string it must return false.
  • It must start with a hashtag (#).
  • All words must have their first letter capitalized.

Example Input to Output:

” Hello there thanks for trying my Kata” => “#HelloThereThanksForTryingMyKata”

” Hello World ” => “#HelloWorld”

My code:

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “rsalgado”

 

xc



Copyright 2017. All rights reserved.

Posted January 11, 2017 by Edmundo in category "Ruby Examples