Utility functions / vCard utility functions (IMPORT FGL VCard) |
Extracts an email from a string representing a vCard.
scan_email( source STRING, type STRING ) RETURNING email STRING
This function parses the vCard string passed as parameter to find "EMAIL" data according to a type, and returns the email address as a string.
The function looks for lines starting with the "EMAIL" keyword.
The second parameter (type) defines is the value of the "TYPE" attribute in an "EMAIL" line. Values can for example be "HOME", "WORK", "pref". If this parameter is NULL, the email with TYPE=pref will be returned. If no preferred email exists, the first email will be returned.
IMPORT FGL VCard MAIN DEFINE m STRING, f TEXT LOCATE f IN FILE arg_val(1) CALL VCard.scan_email(f,NULL) RETURNING m DISPLAY m END MAIN