Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String.Format
Message
De
18/02/2013 12:13:03
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01566272
Message ID:
01566279
Vues:
62
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>Do you know how this VFP format
>
>
>transform(extension, '$,$$$,$$9.99')
>
>translates into StringBuilder AppendFormat ?
>
>Thanks in advance.

Try this - replace 20 with the length you need
	static void Main()
		{

			decimal[] values = {
								   11211105.99m,
								   0m, 
								   1m
							   };

			foreach (decimal x in values)
				Console.WriteLine("{0,20:$#,##0.00}", x);
			

			StringBuilder sb = new StringBuilder();
			sb.AppendFormat("{0,20:$#,##0.00}",  11211105.99m);
			Console.WriteLine(sb.ToString());
			Console.ReadLine();
		}
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform