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