using System;
public class Program
{
public static void Main()
var valor = "12,126456";
var commaPosition = valor.IndexOf(",", StringComparison.Ordinal);
var result = commaPosition+3 > valor.Length ? valor: valor.Substring(0, commaPosition + 3);
Console.WriteLine(result);
}