Code: Detail

C# - (Portuguese)

Obter quantidade de vogais e caracteres

Um exercício muito comum em cursos de programação é obter a quantidade de vogais e/ou caracteres em uma string. Esse script faz isso.

Last update: 18/12/2013

	 string palavra;
	 palavra = "Andre Rodrigues";

	 int _quantidadeVogais = palavra.Count(x => (x == 'a') || (x == 'e') || (x == 'i') || (x == 'o') || (x == 'u'));
	 int _quantidadeLetras = palavra.Length;

Users who have marked this routine as a favorite
13/01/2014 17:19:27
Sim, fica muito mais limpo o codigo.

19/12/2013 12:57:07
Muito com André. 
As expressões lambda quando usadas corretamente simplificam muito a codificação.


The site ti4fun is not responsible for the content on sites for which you have external links

Articles, routines, tips, forums, blogs or any other content posted on ti4fun site is not tested and not validated, so you should test and validate any information collected on the ti4fun site before applying it to final use environment, such as example, production. the TI4FUN site is not responsible for quality or for any damages, direct, indirect or consequential, from use of any content posted by the authors in the site.

All content published on the ti4fun site is the responsibility of the author and do not necessarily express the views of the site ti4fun and its employees.