public static void Main()
Console.WriteLine("Hello World");
Console.WriteLine(preencheDecimal2(" 24740", 2, 9));
public static string preencheDecimal2(string entrada, int dec, int tam)
entrada = entrada.Replace(".", ",");
int virgula = entrada.IndexOf(",");
virgula = entrada.IndexOf(",");
aux = entrada.Length - (virgula + 1);
depois = entrada.Substring(virgula + 1, dec);
depois = entrada.Substring(virgula + 1);
antes = entrada.Substring(0, virgula);
depois = preencheDireita(depois, '0', dec);
antes = preencheEsquerda(antes, ' ', (tam - dec));
return (antes + "," + depois);
public static string preencheEsquerda(string st, char ch, Int32 size)
if (retorno.Length > size)
retorno = retorno.Substring(0, size);
while (retorno.Length < size)
public static string preencheDireita(string st, char ch, Int32 size)
if (retorno.Length > size)
retorno = retorno.Substring(0, size);
while (retorno.Length < size)