28
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
double a=1000.045;
10
Console.WriteLine(a.ToString(("#,0.00")));
11
Console.WriteLine(Math.Round(a, 2));
12
Console.WriteLine(Math.Round(a, 2, MidpointRounding.AwayFromZero));
13
14
double b=0.85555;
15
Console.WriteLine(b.ToString(("P")));
16
17
int c= 123;
18
Console.WriteLine(c.ToString(("d5")));
19
20
string d="000789";
21
Console.WriteLine(d.TrimStart('0'));
22
23
string e = "a,b,c,d,e";
24
Console.WriteLine(
25
string.Join(",",e.Split(',').Select(x=>string.Format("'{0}'",x)))
26
);
27
}
28
}
Cached Result