csharpfftfsharpintegrationinterpolationlinear-algebramathdifferentiationmatrixnumericsrandomregressionstatisticsmathnet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
14 KiB
207 lines
14 KiB
<HTML><HEAD><TITLE>Microsoft.FSharp.Text.Printf</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY>
|
|
<br><dl>
|
|
<dt></dt><dd>
|
|
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Text.html'>Microsoft.FSharp.Text</a>.Printf </h1><br>
|
|
</dd>
|
|
<dt></dt><dd>
|
|
<table>
|
|
<tr valign='top'><td><summary>
|
|
Extensible printf-style formatting for numbers and other datatypes
|
|
|
|
Format specifications are strings with "%" markers indicating format
|
|
placeholders. Format placeholders consist of:
|
|
<tt>
|
|
%[flags][width][.precision][type]
|
|
</tt>
|
|
where the type is interpreted as follows:
|
|
<tt>
|
|
%b: bool, formatted as "true" or "false"
|
|
%s: string, formatted as its unescaped contents
|
|
%d, %i: any basic integer type formatted as a decimal integer, signed if the basic integer type is signed.
|
|
%u: any basic integer type formatted as an unsigned decimal integer
|
|
%x, %X, %o: any basic integer type formatted as an unsigned hexadecimal
|
|
(a-f)/Hexadecimal (A-F)/Octal integer
|
|
|
|
%e, %E, %f, %F, %g, %G:
|
|
any basic floating point type (float,float32) formatted
|
|
using a C-style floating point format specifications, i.e
|
|
|
|
%e, %E: Signed value having the form [-]d.dddde[sign]ddd where
|
|
d is a single decimal digit, dddd is one or more decimal
|
|
digits, ddd is exactly three decimal digits, and sign
|
|
is + or -
|
|
|
|
%f: Signed value having the form [-]dddd.dddd, where dddd is one
|
|
or more decimal digits. The number of digits before the
|
|
decimal point depends on the magnitude of the number, and
|
|
the number of digits after the decimal point depends on
|
|
the requested precision.
|
|
|
|
%g, %G: Signed value printed in f or e format, whichever is
|
|
more compact for the given value and precision.
|
|
|
|
|
|
%M: System.Decimal value
|
|
|
|
%O: Any value, printed by boxing the object and using it's ToString method(s)
|
|
|
|
%A: Any value, printed by using Microsoft.FSharp.Text.StructuredPrintfImpl.Display.any_to_string with the default layout settings
|
|
|
|
%a: A general format specifier, requires two arguments:
|
|
(1) a function which accepts two arguments:
|
|
(a) a context parameter of the appropriate type for the
|
|
given formatting function (e.g. an #System.IO.TextWriter)
|
|
(b) a value to print
|
|
and which either outputs or returns appropriate text.
|
|
|
|
(2) the particular value to print
|
|
|
|
|
|
%t: A general format specifier, requires one argument:
|
|
(1) a function which accepts a context parameter of the
|
|
appropriate type for the given formatting function (e.g.
|
|
an System.IO.TextWriter)and which either outputs or returns
|
|
appropriate text.
|
|
|
|
Basic integer types are:
|
|
byte,sbyte,int16,uint16,int32,uint32,int64,uint64,nativeint,unativeint
|
|
Basic floating point types are:
|
|
float, float32
|
|
|
|
The following format patterns are accepted but a warning is printed:
|
|
|
|
%h(d|u|x|X|o)
|
|
%l(d|u|x|X|o)
|
|
|
|
The following format patterns are now deprecated:
|
|
|
|
%Ld, %Li, %Lu, %Lx, %LX, %Lo: same, but an int64
|
|
%nd, %ni, %nu, %nx, %nX, %no: same, but a nativeint
|
|
%Ud, %Ui, %Uu, %Ux, %UX, %Uo: same, but an unsigned int32 (uint32)
|
|
%ULd, %ULi, %ULu, %ULx, %ULX, %ULo: same, but an unsigned int64 (uint64)
|
|
%Und, %Uni, %Unu, %Unx, %UnX, %Uno: same, but an unsigned nativeint (unativeint)
|
|
</tt>
|
|
The optional width is an integer indicating the minimal width of the
|
|
result. For instance, %6d prints an integer, prefixing it with spaces
|
|
to fill at least 6 characters. If width is '*', then an extra integer
|
|
argument is taken to specify the corresponding width.
|
|
<tt>
|
|
any number
|
|
'*':
|
|
</tt>
|
|
Valid flags are:
|
|
<tt>
|
|
0: add zeros instead of spaces to make up the required width
|
|
'-': left justify the result within the width specified
|
|
'+': add a '+' character if the number is positive (to match a '-' sign
|
|
for negatives)
|
|
' ': add an extra space if the number is positive (to match a '-'
|
|
sign for negatives)
|
|
</tt>
|
|
The printf '#' flag is invalid and a compile-time error will be reported if it is used.
|
|
</summary>
|
|
<dt><h3>Type Definitions</h3></dt><dd>
|
|
<table width="100%%">
|
|
<tr><th width=30%>Type</th><th>Description</th></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_BuilderFormat-2.html'>BuilderFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format associated with writing to a <tt>System.Text.StringBuilder</tt>. The first type parameter indicates the
|
|
arguments of the format operation and the last the overall return type.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.type_Format-4.html'>Format</a><'T,<a href='http://msdn2.microsoft.com/en-us/library/System.Text.StringBuilder.aspx'>StringBuilder</a>,<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>,'Result></tt></td></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_BuilderFormat-1.html'>BuilderFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format associated with writing to a <tt>System.Text.StringBuilder</tt>. The type parameter indicates the
|
|
arguments and return type of the format operation.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.Printf.type_BuilderFormat-2.html'>BuilderFormat</a><'T,<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>></tt></td></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-2.html'>StringFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format when formatting builds a string. The first type parameter indicates the
|
|
arguments of the format operation and the last the overall return type.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.type_Format-4.html'>Format</a><'T,<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>,<a href='Microsoft.FSharp.Core.type__string.html'>string</a>,'Result></tt></td></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-1.html'>StringFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format when formatting builds a string. The type parameter indicates the
|
|
arguments and return type of the format operation.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.Printf.type_StringFormat-2.html'>StringFormat</a><'T,<a href='Microsoft.FSharp.Core.type__string.html'>string</a>></tt></td></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-2.html'>TextWriterFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format associated with writing to a <tt>System.IO.TextWriter</tt>. The first type parameter indicates the
|
|
arguments of the format operation and the last the overall return type.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.type_Format-4.html'>Format</a><'T,<a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a>,<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>,'Result></tt></td></tr>
|
|
<tr valign="top"><td>type <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a></td><td><summary>
|
|
Represents a statically-analyzed format associated with writing to a <tt>System.IO.TextWriter</tt>. The type parameter indicates the
|
|
arguments and return type of the format operation.
|
|
</summary> Note: an abbreviation for <tt><a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-2.html'>TextWriterFormat</a><'T,<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>></tt></td></tr>
|
|
|
|
</table>
|
|
</dd>
|
|
<dt><h3>Values</h3></dt><dd>
|
|
<table width="100%%">
|
|
<tr><th width=60%>Value</th><th>Description</th></tr>
|
|
<tr valign="top"><td><pre>val bprintf : <a href='http://msdn2.microsoft.com/en-us/library/System.Text.StringBuilder.aspx'>StringBuilder</a> -> <a href='Microsoft.FSharp.Text.Printf.type_BuilderFormat-1.html'>BuilderFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to a <tt>System.Text.StringBuilder</tt>
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val eprintf : <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Formatted printing to stderr
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val eprintfn : <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Formatted printing to stderr, adding a newline
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val failwithf : <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-2.html'>StringFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
Print to a string buffer and raise an exception with the given
|
|
result. Helper printers must return strings.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val fprintf : <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to a text writer or an OCaml-compatible channel
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val fprintfn : <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to a text writer or an OCaml-compatible channel, adding a newline
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val kbprintf :
|
|
(<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> 'Result) -> <a href='http://msdn2.microsoft.com/en-us/library/System.Text.StringBuilder.aspx'>StringBuilder</a> -> <a href='Microsoft.FSharp.Text.Printf.type_BuilderFormat-2.html'>BuilderFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
bprintf, but call the given 'final' function to generate the result.
|
|
See <tt>kprintf</tt>.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val kfprintf :
|
|
(<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> 'Result) -> <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-2.html'>TextWriterFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
fprintf, but call the given 'final' function to generate the result.
|
|
See <tt>kprintf</tt>.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val kprintf : (<a href='Microsoft.FSharp.Core.type__string.html'>string</a> -> 'Result) -> <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-2.html'>StringFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
printf, but call the given 'final' function to generate the result.
|
|
For example, these let the printing force a flush after all output has
|
|
been entered onto the channel, but not before.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val ksprintf : (<a href='Microsoft.FSharp.Core.type__string.html'>string</a> -> 'Result) -> <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-2.html'>StringFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
sprintf, but call the given 'final' function to generate the result.
|
|
See <tt>kprintf</tt>.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val ktwprintf :
|
|
(<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> 'Result) -> <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-2.html'>TextWriterFormat</a><'T,'Result> -> 'T</pre></td><td><summary>
|
|
twprintf, but call the given 'final' function to generate the result.
|
|
See <tt>kprintf</tt>.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val printf : <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Formatted printing to stdout
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val printfn : <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Formatted printing to stdout, adding a newline
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val sprintf : <a href='Microsoft.FSharp.Text.Printf.type_StringFormat-1.html'>StringFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to a string via an internal string buffer and return
|
|
the result as a string. Helper printers must return strings.
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val twprintf : <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to any subtype of the .NET type System.IO.TextWriter
|
|
</summary></td></tr>
|
|
<tr valign="top"><td><pre>val twprintfn : <a href='http://msdn2.microsoft.com/en-us/library/System.IO.TextWriter.aspx'>TextWriter</a> -> <a href='Microsoft.FSharp.Text.Printf.type_TextWriterFormat-1.html'>TextWriterFormat</a><'T> -> 'T</pre></td><td><summary>
|
|
Print to any subtype of the .NET type System.IO.TextWriter, and add a newline
|
|
</summary></td></tr>
|
|
|
|
</table>
|
|
</dd>
|
|
</td></tr>
|
|
<tr valign='top'><td>
|
|
<dt><h3>See Also</h3></dt><dd>
|
|
<a href="Microsoft.FSharp.Text.html">Microsoft.FSharp.Text</a> </dd>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p>
|
|
</BODY></HTML>
|
|
|