Usuário com melhor resposta
string personalizada

Pergunta
-
Respostas
-
String.Format . Veja:
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Data.SqlClient; using System.Globalization; namespace Console2._0 { class Program { static void Main(string[] args) { string a = "9558451"; string b = string.Empty; int limite = a.Length - 1; for (int x = 0; x < a.Length; x++) { if(x != limite) b += string.Format("{0}.", a[x]); else b += string.Format("{0}", a[x]); } System.Console.WriteLine(b.ToString()); System.Console.ReadKey(); } } }
Saída:
--
Marque as respostas e ajude a melhorar a busca do fórum.- Editado Paulo César Viana terça-feira, 27 de dezembro de 2011 13:18 anexar resultado
- Marcado como Resposta RafaChoks terça-feira, 27 de dezembro de 2011 13:22
Todas as Respostas
-
String.Format . Veja:
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Data.SqlClient; using System.Globalization; namespace Console2._0 { class Program { static void Main(string[] args) { string a = "9558451"; string b = string.Empty; int limite = a.Length - 1; for (int x = 0; x < a.Length; x++) { if(x != limite) b += string.Format("{0}.", a[x]); else b += string.Format("{0}", a[x]); } System.Console.WriteLine(b.ToString()); System.Console.ReadKey(); } } }
Saída:
--
Marque as respostas e ajude a melhorar a busca do fórum.- Editado Paulo César Viana terça-feira, 27 de dezembro de 2011 13:18 anexar resultado
- Marcado como Resposta RafaChoks terça-feira, 27 de dezembro de 2011 13:22
-
-
Segue o código reduzido:
string a = "9558451"; string b = string.Empty; for (int x = 0; x < a.Length; x++) b += string.Format("{0}.", a[x]); b = b.Remove(b.Length - 1); System.Console.WriteLine(b); System.Console.ReadKey();
--
Marque as respostas e ajude a melhorar a busca do fórum.