7 kyu

Coding 3min : toLoverCase()

162 of 447myjinxin2015

Description:

Task

Yes, your eyes are no problem, this is toLoverCase (), not toLowerCase (), we want to make the world full of love.

What do we need to do?

You need to add a prototype function to the String, the name is toLoverCase. Function can convert the letters in the string, converted to "L", "O", "V", "E", if not the letter, don't change it.

How to convert? :

"love!".toLoverCase()="EVOL!"
    "l" is 11th(start with 0) in lower case letters
    abcdefghijklmnopqrstuvwxyz
               |
    0...      11----------------->11th letter
    We use this number mod 4------> 11 % 4 = 3
    
    the 3rd(also start with 0) letter of "LOVE" is "E"
    LOVE
       |
       3--------->3rd letter
       
    so convert "l" to "E".
    
    and so on..
    
    "o" convert to "V", "v" convert to "O", "e" convert to "L"
    
    last "!" remain unchanged, because it's not a letter.
    

more example see the testcases.

Series:

Puzzles
Games

Stats:

CreatedApr 17, 2016
PublishedApr 17, 2016
Warriors Trained984
Total Skips19
Total Code Submissions1706
Total Times Completed447
JavaScript Completions162
Ruby Completions50
Python Completions243
Haskell Completions31
Total Stars11
% of votes with a positive feedback rating87% of 148
Total "Very Satisfied" Votes117
Total "Somewhat Satisfied" Votes23
Total "Not Satisfied" Votes8
Ad
Contributors
  • myjinxin2015 Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • user9644768 Avatar
  • cliffstamp Avatar
  • Just4FunCoder Avatar
  • farhanaditya Avatar
Ad