This site's content was compiled from 1993 to 2006. Beyond that, Google is your friend.

FOIL

Maintainer

Sami Hangaslammi

Description

A comprehensive library for formatted input and output.

Usage is very similar to C's sprintf and sscanf.

Categories

Versions

Links

Details

To use the FOIL library, create an instance of FORMATTED_IO and use its 'printf', 'format_string' and 'read_formatted' methods. There is also an example program 'format_test.e' which demonstrates the usage of formatting tags.

Formatting Tags

The formatting string contains standard text except for tags that represent variables. Tags start with "&" (use "&&" to insert a literal '&' in the text). Most tags work for both input and output.

It is very easy to create customised tags, but standard tags are provided to read and write INTEGERs, REALs, DOUBLEs, general numbers, fixed-point numbers, CHARACTERs, BOOLEANs, STRINGs and general values.

Modifier tags modify the formatting of another tag, and are mainly used when formatting COLLECTION objects. They can capitalise the first letter, append or prepend text, adjust whitespace, adjust width by padding or truncating, align left or right, or enclose between delimiters such as quotes or brackets.

Collections can be read and written with or without delimiters, all-at-once or in groups. Recursive formatting can be used, for example to process key-value pairs.

Supported compilers

Licensing

Google
 
Web eiffelzone.com