Difference between revisions of "Character and string types"
From Lazarus wiki
Jump to navigationJump to searchJwdietrich (talk | contribs) |
Jwdietrich (talk | contribs) |
||
Line 5: | Line 5: | ||
A variable of type AnsiChar is exactly 1 byte in size, and contains one ASCII character. | A variable of type AnsiChar is exactly 1 byte in size, and contains one ASCII character. | ||
− | {| class="wikitable" style="text-align:center | + | {| class="wikitable" style="text-align:center; width:25px" |
|- | |- | ||
| style="width: 100%;" | a | | style="width: 100%;" | a | ||
Line 17: | Line 17: | ||
A variable of type WideChar is exactly 2 bytes in size, and contains one [[LCL Unicode Support|Unicode]] character in UTF-16 encoding. | A variable of type WideChar is exactly 2 bytes in size, and contains one [[LCL Unicode Support|Unicode]] character in UTF-16 encoding. | ||
− | {| class="wikitable" style="text-align:center | + | {| class="wikitable" style="text-align:center; width:50px" |
|- | |- | ||
| style="width: 50%;" | || style="width: 50%;" | a | | style="width: 50%;" | || style="width: 50%;" | a | ||
Line 24: | Line 24: | ||
==== Reference ==== | ==== Reference ==== | ||
* [http://www.freepascal.org/docs-html/ref/refsu8.html FPC WideChar documentation] | * [http://www.freepascal.org/docs-html/ref/refsu8.html FPC WideChar documentation] | ||
+ | |||
+ | == PChar == | ||
+ | |||
+ | A variable of type PChar is basically a pointer to a Char type, but allows additional operations. PChars can be used to access C-style null-terminated strings, e.g. in interaction with certain OS libraries or third-party software. | ||
+ | |||
+ | {| class="wikitable" style="text-align:center; width:100px" | ||
+ | |- | ||
+ | | style="width: 25%;" | a || style="width: 25%;" | b || style="width: 25%;" | c || style="width: 25%;" | #0 | ||
+ | |} | ||
[[Category: FPC]] | [[Category: FPC]] | ||
[[Category: Data types]] | [[Category: Data types]] |
Revision as of 15:56, 28 December 2013
Free Pascal supports several types of characters and strings.
AnsiChar
A variable of type AnsiChar is exactly 1 byte in size, and contains one ASCII character.
a |
Reference
WideChar
A variable of type WideChar is exactly 2 bytes in size, and contains one Unicode character in UTF-16 encoding.
a |
Reference
PChar
A variable of type PChar is basically a pointer to a Char type, but allows additional operations. PChars can be used to access C-style null-terminated strings, e.g. in interaction with certain OS libraries or third-party software.
a | b | c | #0 |