Ver Mensaje Individual
  #14  
Antiguo 20-03-2016
Avatar de BDWONG
BDWONG BDWONG is offline
Miembro
NULL
 
Registrado: nov 2013
Posts: 113
Reputación: 11
BDWONG Va por buen camino
Aquí una pequeña variación de la función de eficsia evitando usar excepciones

Código Delphi [-]
function foo(const s: string): string;
const
  MSG: array [Boolean] of string = ('Adios', 'Hola');
begin
   Result := MSG[(Length(s)>=2) and (s[1] = '/') and (s[2] = '/')];
end;

begin

  Writeln(foo('sinBarras'));
  Writeln(foo('//conBarras'));
  ReadLn;
end.
Responder Con Cita