Ver Mensaje Individual
  #4  
Antiguo 28-10-2008
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.285
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Puedes utilizar un Try..except en la conversión:
Código Delphi [-]
try
  StrToInt(...)
  // correcto si llega aquí
except 
  // Incorrecto si llega aquí
end;

Si sabes que valores va a tomar (o mejor) uno que no vaya a tomar puedes utilizar StroIntDef:

Código Delphi [-]
i := StrToIntDef(cad1, -9999);
if (i := -9999) then begin
  // error al convertir
end;

También se puede usar el procedimiento Val (mira en la ayuda) que este lo tengo más olvidado.

Usando alguna de las tres no es muy difícil hacer una función del tipo: IsvalidInteger()

AÑADO: Veo que había más...
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita