[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Scan a string for substrings and return the content of these substrings as typed values
Source position: sysstrh.inc line 252
function SScanf( |
const s: string; |
const fmt: string; |
const Pointers: array of Pointer |
):Integer; |
SScanF does in essence the opposite of Format: it scans the string S for the elements specified in Fmt, and returns the value of the found elements in the memory locations pointed to by the addresses in Pointers. The Fmt can contain placeholders of the form %X where X can be one of the following characters:
The Pointers array contains a list of pointers, each pointer should point to a memory location of a type that corresponds to the type of placeholder in that position:
On return, these locations will be filled with the actual values found in S for the placeholders in fmt. The return value of the function is the number of found values.
No error checking is performed on the type of the memory location.
|
Format a string with given arguments. |
Program Example98; {$mode objfpc} {$h+} { This program demonstrates the function } Uses sysutils; var count,i: Integer; f: Extended; s: String; begin count:=SScanf('234 32.4 hello','%d %f %s',[@i,@f,@s]); writeln(count,' ',i,' ',f,' ',s); End.