/// /// Completa Número /// /// Numero a ser testado /// Quantidade de casas desejada na parte antes da casa decimal /// Quantidade de casas após o ponto(.) decimal /// private string CompletaNumero(string numero, int casas1, int casas2) { string[] arrNumero = numero.Split('.'); string str1 = arrNumero[0]; string str2 = arrNumero[1]; string final = string.Empty; if (arrNumero.Rank == 2) { if (str1.Length < casas1) { str1.PadLeft(casas1, ' '); } if (str2.Length < casas2) { str2.PadRight(casas2, '0'); } final = str1 + "." + str2; } else { if (str1.Length < casas1) { str1.PadLeft(casas1, ' '); } final = str1 + ".00"; } return final; }