Difference between revisions of "Char/fr"

From Lazarus wiki
Jump to navigationJump to search
(New page: {{Char}} A '''char''' is a single character. A byte and a char are the same thing, except a char can be used as a character, or as part of a string type, and cannot b...)
 
Line 1: Line 1:
 
{{Char}}
 
{{Char}}
  
A '''char''' is a single characterA [[Byte|byte]] and a char are the same thing, except a char can be used as a character, or as part of a [[String|string]] type, and cannot be used in an arithmetic expression, while a byte can only be referred to as a numeric type.
+
un '''char''' est un simple caractèreUn [[Byte|octet]] et un char sont la même chose , excepté qu'un char peut être employé comme caractère , ou en tant qu'élément de type [[String|chaîne de caractères]], et ne peut pas être employé dans une expression arithmétique , tandis qu'un octet peut seulement se reporter comme un type numérique .
  
For example:
+
Par exemple :
 
<tt>
 
<tt>
 
: var ch: char;
 
: var ch: char;
Line 9: Line 9:
 
:
 
:
 
: begin
 
: begin
: {{Tab4}}  ch := 'A';  c := 64;  { are the same action, and are legal }
+
: {{Tab4}}  ch := 'A';  c := 64;  { ont la même action, et sont légaux  }
: {{Tab4}}  ch := 64;  c := 'A'; { while they are the same action, this is illegal }
+
: {{Tab4}}  ch := 64;  c := 'A'; { bien qu'ils aient la même action , c'est illégal  }
 
: end.
 
: end.
 
</tt>
 
</tt>
  
The use of char or byte as a data type provides better documentation as to the purpose of the use of the particular variable.  The char type can be [[coersion|coerced]] to byte by using the [[ord]] functionByte type values can be coerced to char by using the [[chr]] function.
+
L'utilisation de char ou de byte comme type de données fournit une meilleure documentation quant à  le but d'utiliser de une variable particulière Le type char peut être  [[coersion|contraint]] vers le type byte en employant la fonction  [[ord]].  Les valeurs de type byte peuvent être contrainte vers le type char en employant la fonction [[chr]].
  
 
type chars functions follows the [[ASCII]].
 
type chars functions follows the [[ASCII]].

Revision as of 17:00, 12 June 2007

Deutsch (de) English (en) español (es) français (fr) italiano (it) русский (ru)

un char est un simple caractère. Un octet et un char sont la même chose , excepté qu'un char peut être employé comme caractère , ou en tant qu'élément de type chaîne de caractères, et ne peut pas être employé dans une expression arithmétique , tandis qu'un octet peut seulement se reporter comme un type numérique .

Par exemple :

var ch: char;
    c: byte;
begin
     ch := 'A'; c := 64; { ont la même action, et sont légaux }
     ch := 64; c := 'A'; { bien qu'ils aient la même action , c'est illégal }
end.

L'utilisation de char ou de byte comme type de données fournit une meilleure documentation quant à le but d'utiliser de une variable particulière . Le type char peut être contraint vers le type byte en employant la fonction ord. Les valeurs de type byte peuvent être contrainte vers le type char en employant la fonction chr.

type chars functions follows the ASCII.

The above program corrected to legal use:

var ch: char;
    c: byte;
begin
     ch := 'A'; c := 64; { are the same action, and are legal }
     ch := chr(64); c := ord('A'); { now legal }
end.


navigation bar: data types
simple data types

boolean byte cardinal char currency double dword extended int8 int16 int32 int64 integer longint real shortint single smallint pointer qword word

complex data types

array class object record set string shortstring