Closed InDaPond closed 6 years ago
okay im too stupid to format the code properly, how does a newline work in there?
Hi,
To get all fields you can just use regular map access:
var card vcard.Card // Let's assume `card` is a vcard
tel := card[vcard.FieldTelephone]
emails, hasEmails := card[vcard.FieldEmail]
Thank you for the fast reply - this is indeed what I was looking for, therefore my issue makes no sense - CLOSED :)
just a quick follow-up question:
If I go for card.PreferredValue(vcard.FieldTelephone)
I get something like this: +1 49 444666
whereas the real number is +49 444666 - Is there a method to remove that +1 or do I just regex that away?
It seems like the original data contains this +1 - vcard doesn't care about this, it just parses the field and returns its value. Read the original vcard file to check this.
Side note, don't use regexp when you have a good stdlib with things like strings.TrimPrefix
.
Thanks, within all the contacts I took one as a sample which seemed fitting - but you are right again, it's a bug there. Thanks and hopefully finally Closed ;)
I would love to access all Fields, so far you only can Get one(the preferred) value by calling Get. You have access to all the Values, but that might not be sufficient: In my case, I want to have the details on all existing phone Numbers, so whether that phoneNumber is for Work, Home, Cell, etc.
So my simple suggestion:
and on that you can extract all necessary information. Or is there a better way to extract all phone Numbers with the details on them?