Guest User

Untitled

a guest
Aug 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. let array = ["1,8", "3,5", "2,5", "4"]
  2. let sortedArray = array.flatMap({ Double($0.replacingOccurrences(of: ",", with: ".")) }).sorted()
  3. print(sortedArray) //[1.8, 2.5, 3.5, 4.0]
Add Comment
Please, Sign In to add comment