Created
November 22, 2018 14:52
-
-
Save mmar/49f367e7a3295bc5bf40d7c1271bb208 to your computer and use it in GitHub Desktop.
Try to guess names from email addresses in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
var guessedNameFromEmail: String? { | |
return self.split(separator: "@").first?.split(separator: ".").map { $0.capitalized(with: Locale.autoupdatingCurrent) }.joined(separator: " ") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment