Ver Mensaje Individual
  #6  
Antiguo 16-03-2016
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Reputación: 12
feliz-58 Va por buen camino
Cita:
Empezado por ecfisa Ver Mensaje
Hola, respuesta rápida
Código Delphi [-]
function foo(const s: string): string;
begin
  if (s[1] = '/')and(s[2] = '/') then
    Result := 'Hola'
  else
    Result := 'Adios';
end;
O también:
Código Delphi [-]
function foo(const s: string): string;
const
  MSG: array[Boolean] of string = ('Adios','Hola');
begin
  Result := MSG[(s[1] = '/')and(s[2] = '/')];
end;

Uso:
Código Delphi [-]
 
  ShowMessage(foo('//ClubDelphi'));

Saludos
Agradecimiento Rápido. Saludos!
Responder Con Cita