Advertisement
Guest User

Fizz-Buzzify a String - Swift

a guest
Jun 28th, 2017
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.13 KB | None
  1. func f(s:String){print(s.map{let d=Int(UnicodeScalar("\($0)")!.value);return d%2<1 ?d>90 ?"fizz":"FIZZ":d>90 ?"buzz":"BUZZ"}.joined())}
Advertisement
RAW Paste Data Copied
Advertisement