public static void Main()
String s = "0323323.02332.222";
Console.WriteLine("Add comma only");
Console.WriteLine(NurmericToCurrentCyFormat(s));
Console.WriteLine("Add comma only with decimal places limit = 2");
Console.WriteLine(NurmericToCurrentCyFormat(s,2));
Console.WriteLine("Add comma only with decimal places limit = 6");
Console.WriteLine(NurmericToCurrentCyFormat(s,6));
public static string NurmericToCurrentCyFormat(string dcString,int? maxDecimalPlaces = null){
var splitted = dcString.Split('.');
int beforeDot= int.TryParse(splitted[0],out int bfDot) ? bfDot : 0;
string decimalPlaces = splitted[1];
if(maxDecimalPlaces.HasValue && decimalPlaces.Length > maxDecimalPlaces.Value){
decimalPlaces = decimalPlaces.Substring(0,maxDecimalPlaces.Value);
return string.Format("{0}.{1}",beforeDot.ToString("N0"),decimalPlaces);
return beforeDot.ToString("N0");