Format Options for sprintf and printf : sprintf « String « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » String » sprintf 




Format Options for sprintf and printf
   
Option      Meaning
%c      Insert a single character.
%d      Insert an integer value.
%e      Insert a floating-point value in scientific notation format.
%f      Insert a floating-point value.
%g      Insert a floating-point value in scientific notation format.
%i      Insert a signed integer value.
%o      Insert an integer in octal (base 8format.
%s      Insert a string value.
%u      Insert an unsigned integer value.
%x      Insert an integer and display in hexadecimal (base 16format. (%X forces the hexadecimal digits to appear uppercase.)

   
    
    
  














Related examples in the same category
1.Format 1234.56789
2.Adding float-point number to the result returning from sprintf function
3.Converting digit to string with sprintf
4.Format and sprintf
5.The sprintf command returns a formatted string
6.Using sprintf to format a float-point number and assign the result to a variable
7.Using sprintf.
8.print sprintf "%+.4e\n", $value;
9.print sprintf "%.2f", 3.1415926;
10.print sprintf "%6.6f\n", $value;
11.sprintf function assigns the formatted string to a variable.
12.sprintf function with array variable
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.