Function:Write formatted data into a stringHeader file:Stdio. hFunction prototype:Int sprintf (char * buffer, const char * format, [argument]… );Parameter List:Buffer: char pointer, pointing to the string address to be written.Format: char pointer.
Turn from: http://nnssll.blog.51cto.com/902724/198237/
The use of sprintf functions1, the function is contained in the stdio.h header file.2, sprintf and usually we often use the printf function is very similar. The sprintf function
Definition and usageThe sprintf () function writes a formatted string to a variable.Grammarsprintf (format,arg1,arg2,arg++)
Parameters
Description
Format
Necessary. Conversion format.
Arg1
sprintfString formatting commands, the main function is to write formatted data into a string. sprintf is a variable parameter function, often problems when used, and as long as the problem is usually can cause the program crashes the memory access
Sprintf function usage in php. Previously, I heard from my teacher that the sprintf () function must use the echo method to display the formatted string and output. let's take a look at the simple method. I have read some materials. I have heard
Sprintf function usage
(19:33:00)
[Favorites] [Comment] Print] Close]
From csdnCommunityElectronic Magazine-C/C ++ magazine
When constructing various types of data into strings, the powerful features of sprintf seldom disappoint you.
$ Booksql = sprintf ("Update book set pass = % s where id = % d ",Getsqlvaluestring ($ _ post ['LIST'], "text "),Getsqlvaluestring ($ _ Get ['id'], "int "));
The getsqlvaluestring function can be changed to another function.
But use the sprintf ()
PHP function serialize () and unserialize () Usage instance, sprintf function usage
This example describes the PHP function serialize () and unserialize () usage. Share to everyone for your reference. Here's how:
This example mainly describes the
[Original walkerlee] notes on learning PHP function sprintf. P study notes on PHP function sprintf () sprintf formatting strings. Syntax: stringsprintf (stringformat, mixed [args]...); return value: string type: data processing P> Study Notes on the
In the past, I heard from my teacher that the sprintf () function must use the echo method to display the formatted string and output. Let's take a look at the simple method.
I am reading some documents and always see the following code when reading
UsageSprintf (format, arg1, arg2, arg ++)DescriptionThe format parameter is the conversion format. It starts with the percent sign ("%") and ends with the conversion character. The following possible format values:• %-Return percent sign• % B-binary
I am reading some documents and always see the following code when reading books: The code is as follows:Copy code $ Query = sprintf ('Insert INTO % sUSER (USERNAME, PASSWORD ,'.'Email _ ADDR, IS_ACTIVE, PERMISSION) VALUES ("% s", % d, % d )',DB_
Transfer from http://www.cnblogs.com/bushuo/p/5657730.htmlFirst of all, why write the preface to this function, this is I developed in two times a token verification document is a sample document see a function, then very do not understand, then
This article mainly introduces the use of PHP sprintf function, need friends can refer to the followingControl floating-point number printing format floating point of print and format control is a common function of sprintf, floating-point numbers
1. Echo Function:The output function , which is a command, cannot return a value. Echo can be followed by a number of parameters, separated by semicolons, such as:echo $myvar 1;Echo, $myvar, "bold";2. print Function:is a function that returns a
Php sprintf function usage
This article mainly introduces the usage of php sprintf functions. For more information, see
Control floating point print format
The printing and format control of floating point numbers is a common function of
1. Echo Function:The output function , which is a command, cannot return a value. Echo can be followed by a number of parameters, separated by semicolons, such as:Echo $myvar 1 Echo ,$myvar, "bold";2. print Function:is a function that returns a
1. Percent: replace% to%
$STR = ' Test the percent of this parameter, what will be replaced by ';
echo sprintf ($STR);
Return result: Test the% of this parameter, which will be replaced by what (percent is replaced by a%)
2. %b:
When constructing various types of data into strings, the powerful features of sprintf seldom disappoint you. Since sprintf and printf have almost the same usage, but the printing destination is different, the former is printed into the string, and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.