next up previous contents
Next: Searching for Strings Up: Exact string Search Previous: Exact string Search

String Format Scan - sscanf

The sscanf function provides the same service as the printf does except in the opposite direction.
sscanf(text : name, pattern : name)
The text is the item of type name you would like to scan (any name which can be produced by a printf command is valid). The second is the patternwhich may contain conversion patterns (see §[*]). The pattern name specifies how to interpret text. Starting at the leftmost character of text, this function attempts to match the first conversion pattern in pattern to text. If it succeeds, it stores this as the first element of a list. It then tries to match the second element of the conversion pattern at the point in textwhere it left off. When either (1) all conversion patterns have been exhausted, (2) text is entirely parsed, or (3) it fails to match a conversion pattern to text, sscanf finishes and returns the list of successful matches.

> matches := sscanf('MMAA21336  standard; RNA; EST; 410 NToInt', 
>                    '%s %s %s %s %d %s');

In general, the pattern name may contain:


next up previous contents
Next: Searching for Strings Up: Exact string Search Previous: Exact string Search
Gaston Gonnet
1998-09-15