
Now that we have laid the groundwork, we will soon be ready to format phone numbers. Here is an example of how instances of the new facet class can be used:
ostream ofstr("/tmp/out");
ostr.imbue(locale(locale::classic(),new US_phone_put)); //1
ostr << phoneNo("Fr","1","60 17 07 16") << endl;
ostr << phoneNo("US","541","711-PARK") << endl;
ostr.imbue(locale(locale("Fr") //2
,new Fr_phone_put (&myTab,"France")));
ostr << phoneNo("Allemagne","89","636-40938") << endl; //3
| //1 | Imbue an output stream with a locale object that has a phone number facet object. In the example above, it is the US English ASCII locale with a US phone number facet, and | |||
| //2 | A French locale using a French phone number facet with a particular country code table. | |||
| //3 | Output phone numbers using the inserter function. The output will be:
|
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.