Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 328 Bytes

name_shuffler.md

File metadata and controls

14 lines (11 loc) · 328 Bytes

Description

Write a function that returns a string in which firstname is swapped with last name.

Example(Input --> Output)

"john McClane" --> "McClane john"

My Solution

def name_shuffler(str)
  str.split.reverse.join(' ')
end