Jump to content

Recommended Posts

Posted

Bom dia a todos .

Preciso de ajuda numa sugestão de utilizadores depois de inserido o nome .

Queria algo deste genero :

Nome : João Carlos da Silva Almeida

E depois de carregar no botão para sugestão , aparecer algo do genero :

Utilizador: JAlmeida

Aceito sugestoes xD

Obrigado

Posted

Já tenho o codigo para conseguir o primeiro caracter em maiuscula .

   
            nome = txtnome.Text;
            tamanho = nome.Length;
            char1 = nome[0];
            primeira = Convert.ToString(char1);
            primeira = primeira.ToUpper();
            MessageBox.Show(primeira);

Agora a minha duvida é , como consigo contar caracteres a partir da direita , até que haja um espaco , ou seja, isto vai-me retornar o ultimo nome .

Posted
string a = "duMmY user nAME";
a = string.Format("{0}{1}", a.Trim()[0].ToString().ToUpper(), System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase (a.Trim().Split(' ')[a.Trim().Split(' ').Length - 1]));

my 2 cents

I used to have a life ... but i bought a programmable machine in 1982 ...

Posted

string a = "duMmY user nAME";
a = string.Format("{0}{1}", a.Trim()[0].ToString().ToUpper(), System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase (a.Trim().Split(' ')[a.Trim().Split(' ').Length - 1]));

my 2 cents

Fiz dessa maneira e funcionou perfeito mesmo .

Obrigado inginheiro  😛

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.