Freddy Abreu

Freddy Abreu

  • NA
  • 40
  • 9.4k

Count words, and skip the spaces.

Apr 10 2013 9:20 AM
Hi, this something very basic I know it, but how can I skip the spaces in this basic program please.

            string Palabras = string.Empty;
            //int ContEspacios;            
            
                
            
            Console.WriteLine("Escribe una palabra:");
            Palabras = Console.ReadLine();
            
            foreach (var X in Palabras.Length.ToString())
            {
            
            
                Console.WriteLine("Cuantas palabras tiene {0}:",X);
            }
            
            
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

Answers (6)