Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String.Format
Message
From
18/02/2013 14:27:31
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01566272
Message ID:
01566303
Views:
54
>>
>>	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();
>>		}
>>
>>
>>
>>
>
>In C# with your code
>
>-$3.20
>
>and in VFP
>
>$-3.20
>
>In other words, the - is after $ in VFP. What should I change to get that?
>
>Although I think it's so minor, that I should probably be OK with what I have.

Are you sure programming is the right job for you ?
		static void Main()
		{

			decimal[] values = {
								  -3.2m,
								   0m, 
								   3.2m
							   };

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

			
			Console.ReadLine();

		}
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform