Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   manejar string y numeros en un edit (https://www.clubdelphi.com/foros/showthread.php?t=69454)

jeremiselxi 19-08-2010 13:51:20

manejar string y numeros en un edit
 
hola gente del foro como estan?

tengo una duda de como manejar string y numeros en un edit.

ejemplo miren este mandato que me pusieron

DIJITAR LETRAS Y NUMEROS EN UN EDIT Y LUEGO IMPRIMA CUANTOS NUMEROS Y CUANTAS LETRAS HAY.

he buscado algunos datos en internet pero no los entiendo bien. alguien me ayuda por favor

Caro 19-08-2010 15:28:48

Hola jeremiselxi, tienes que recorrer tu cadena y verificar cual es numero o letra e ir contando:

Código Delphi [-]
 Valor := Edit1.Text;
 for i:=1 to Length(Valor) do
 begin
  if Valor[i] in ['0'..'9'] then
   Inc(CantNum);
  if Valor[i] in ['a'..'z','A'..'Z'] then
   Inc(CantLetras);
 end;

Saluditos

jeremiselxi 26-08-2010 05:23:40

Gracias
 
Mi hermano muchas gracias por la ayuda, es precisamente lo que queria.


La franja horaria es GMT +2. Ahora son las 07:44:42.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi