Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   String to Variant (https://www.clubdelphi.com/foros/showthread.php?t=59357)

MaMu 23-08-2008 22:11:43

String to Variant
 
Como paso un String a Variant ?

Código Delphi [-]
 
function (MiString:string): Variant;
begin
  //????
end;

cHackAll 23-08-2008 22:24:25

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 s: string;
 v: Variant;
begin
 s := 'MaMu';
 v := Variant(s);
 ShowMessage(v);
end;

roman 25-08-2008 15:58:06

Cita:

Empezado por MaMu (Mensaje 309037)
Como paso un String a Variant ?

No necesitas una conversión especial. Por eso son variants:

Código Delphi [-]
var
  S: String;
  V: Variant;

begin
  S := 'Hola pepe';
  V := S;
end;

// Saludos


La franja horaria es GMT +2. Ahora son las 03:49:44.

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