NAME sscanf - Parse a string with a given format SYNOPSIS int sscanf(string str, string fmt, mixed var1, mixed var2 ...) DESCRIPTION Parse string `str' with the format `fmt' and return matched pieces in the given variables. %s and %d in the format string refers to a string and a number respectively. The variables must be defined earlier as `strings' for those connected to a %s and `int' for those connected to a %d. You can now also use %*s and %*d in the format string. These correspond to %s and %d respectively but do not need a matching variable for the result, thus eliminating unnecessary temporary variables if you're only interested in the pattern and not the actual contents of the string. EXAMPLES sscanf("good morning", "%s %s", var1, var2) == 2 var1 is set to "good" and var2 to "morning" sscanf("10 hi", "%d ", var) == 1 var is set to 10 sscanf("from bag", "%s %d", var1, var) == 1 var1 is set to from and var is unchanged sscanf(file_name(this_object()), "%*s#%*d") == 2 this_object() is a clone
Help topics available:
You are guest number 126 since November 2019.
This file was last modified: June 2000.