Since there are a lot of these printing/formatting occurrences in the wallet app, it makes sense to pull them out into helpers. And since they are somewhat tied to the PersonName class, I think it makes more sense to have them here in the SDK rather than in the app. Also integrators can reuse them if they are in the SDK.
I decided NOT to strip the trailing white space if the givenName is null (see the comments in the test). The case should be rare enough (at least in Switzerland?), so I don't want to pay the overhead of a trim() function call or introduce more if-else complexity. The trailing whitespace shouldn't hurt in the UI. But feel free to convince me of the opposite :)
This is in preparation to fixing https://github.com/admin-ch/CovidCertificate-App-Android/issues/370.
Since there are a lot of these printing/formatting occurrences in the wallet app, it makes sense to pull them out into helpers. And since they are somewhat tied to the
PersonName
class, I think it makes more sense to have them here in the SDK rather than in the app. Also integrators can reuse them if they are in the SDK.I decided NOT to strip the trailing white space if the givenName is null (see the comments in the test). The case should be rare enough (at least in Switzerland?), so I don't want to pay the overhead of a trim() function call or introduce more if-else complexity. The trailing whitespace shouldn't hurt in the UI. But feel free to convince me of the opposite :)