scan_address()

Extracts an address from a string representing a vCard.

Syntax

scan_address(
   source STRING,
   type STRING )
  RETURNING address VCAddress
  1. source is the vCard string (version 3.0).
  2. type is the type of address (HOME, WORK, pref).
  3. address is the address found, returned as VCAddress structure.

Usage

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.

Example

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