delphi
Tamanho
(Bytes)
Valores
(versão Delphi4)
ShortInt
1
{-128, ..., -1, 0, 1, ..., 127}
LongInt
4
{-2147483648, ..., -1, 0, 1, ..., 2147483647}
SmallInt
2
{-32768, ..., -1, 0, 1, ..., 32767}
Integer
4
{-2147483648, ..., -1, 0, 1, ..., 2147483647}
Byte
1
{0, 1, 2, ..., 255}
Cardinal
4
{0, 1, 2, ..., 4294967295}
Word
2
{0, 1, 2, ..., 65535}
Longword
4
{0, 1, 2, ..., 4294967295}
Int64
8
{-263, ...,263-1}
Single
4
{flutuantes com 7 dígitos significativos e Emáx=38}
Real
6
{flutuantes com 15 dígitos significativos e Emáx=38}
Double
8
{flutuantes com 15 dígitos significativos e Emáx=308}
Extended
10
{flutuantes com 19 dígitos significativos e Emáx=4932}
Char
1
{caracteres ANSI}
String
1 / carac. + 1
{seqüências de caracteres terminadas em nulo}
Boolean
1
{False, True}
EXEMPLO DE FUNCAO POS
const texto = 'aline marcondes dos santos' ; var t:integer; begin t := pos('tos',texto);
Label1.Caption := inttostr(t); end; EXEMPLO DE FUNCAO STRINGREPLACE
const texto = '133,25'; texto2 = '133,25'; var t,t2:string; begin t := StringReplace(texto,',','.',[rfReplaceAll]); Label1.Caption := t; end; EXEMPLO FUNCAO COPY
Copia pedaços da string
const texto = '133,25'; var resultado:string; begin Label1.Caption := copy(texto,1,3)+ '.' +copy(texto,5,2); end; EXERCICIOS UTEIS
Coloca uma palavra ao contrario
const texto = 'aline'; var c,Tam:Integer;
Aux,result:String;
begin
Tam:=Length(texto);
Aux:=''; for c := Tam downto 1 do
Aux:=Aux+Texto[c];
Label1.Caption :=Aux; end; Colocar Hora e Data no sistema
begin Label1.Caption := TimeToStr(Now); Label2.Caption := DateToStr(Now); end; Usando potenciação
Obs : antes declarar math no campo users
var n:double; begin n := power(2,3);
Edit1.Text := floattostr(n); end; Colocar um item (listBox) dentro de um label label4.caption = listBox1.SelectedItem.ToString();
Para adicionar uma