Hi all,
I've been around in these circles for over 10 years, but I'm starting to get back into the online forum circles. Just thought this would be a good share!
When you work with any major apps, you often need to deal with customer's names. It's not safe to assume that every user follows the western First/Last conventions. For example, I'm Australian but I live in Japan, and we format names Last/First.
Sometimes attention not being paid to this can lead to problems. I discovered this, and I thought I'd share.
I've been around in these circles for over 10 years, but I'm starting to get back into the online forum circles. Just thought this would be a good share!
Swift:
// Example 1
let formatter = PersonNameComponentsFormatter()
formatter.style = .long
let components = formatter.personNameComponents(from: "Mac Rumors")
print(components!.givenName!) // Mac
print(components!.familyName!) // Rumors
// Example 2
var formatter = PersonNameComponents()
formatter.familyName = "Rumors"
formatter.givenName = "Mac"
print(formatter) // "firstname: Mac familyname: Rumors"
When you work with any major apps, you often need to deal with customer's names. It's not safe to assume that every user follows the western First/Last conventions. For example, I'm Australian but I live in Japan, and we format names Last/First.
Sometimes attention not being paid to this can lead to problems. I discovered this, and I thought I'd share.