ExtraTopLevelOperators.sprintf<'T> Function (F#)

ExtraTopLevelOperators.sprintf<'T> Function (F#)

The sprintf function prints to a string using the given format.

Namespace/Module Path: Microsoft.FSharp.Core.ExtraTopLevelOperators

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
sprintf : StringFormat<'T> -> 'T

// Usage:
sprintf format


Type: StringFormat<'T>

This function is named PrintFormatToString in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

The following code example illustrates the use of sprintf.

let printToString value =
    sprintf "Formatted string with value %d..." value
printfn "%s" (printToString 109)

Formatted string with value 109...

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

F# Runtime

Supported in: 2.0, 4.0


Supported in: 3

Community Additions

© 2016 Microsoft