daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Aug 16th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top