ExtraTopLevelOperators.sprintf<'T>, fonction (F#)
La fonction sprintf imprime sur une chaîne à l'aide du format donné.
Espace de noms/Chemin du module : Microsoft.FSharp.Core.ExtraTopLevelOperators
Assembly : FSharp.Core (in FSharp.Core.dll)
// Signature:
sprintf : StringFormat<'T> -> 'T
// Usage:
sprintf format
Paramètres
- format
Type : StringFormat<'T>
Notes
Cette fonction se nomme PrintFormatToString dans les assemblys compilés. Si vous accédez à la fonction à partir d'un langage autre que F# ou par réflexion, utilisez ce nom.
Exemple
L'exemple de code suivant illustre l'utilisation de sprintf.
let printToString value =
sprintf "Formatted string with value %d..." value
printfn "%s" (printToString 109)
Plateformes
Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2
Informations de version
Runtime F#
Pris en charge dans : 2.0, 4.0
Silverlight
Prise en charge dans : 3
Voir aussi
Référence
Core.ExtraTopLevelOperators, module (F#)
Microsoft.FSharp.Core, espace de noms (F#)
Historique des modifications
Date |
Historique |
Motif |
---|---|---|
Mai 2010 |
Ajout d'un exemple de code |
Améliorations apportées aux informations. |