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