PWideChar = ^WideChar;
Description
The PWideChar type holds a pointer to a WideChar value.
It can also be used to point to characters within a WideString, as in the example code.
As with other pointers, integer arithmetic, such as Inc and Dec can be performed on a PWideChar variable, also shown in the example.
Notes
PWideChar is principally used when processing null-terminated (C-like) strings.
Related commands
$ExtendedSyntax Controls some Pascal extension handling
Dec Decrement an ordinal variable
Inc Increment an ordinal variable
PAnsiChar A pointer to an AnsiChar value
PChar A pointer to an Char value
PWideString Pointer to a WideString value
WideChar Variable type holding a single International character
WideString A data type that holds a string of WideChars
Example code : Display all characters in a string
var
myWideString : WideString;
myWideCharPtr : PWideChar;
i : Integer;
begin
// Create a string of WideChar's
myWideString := 'Hello';
// Point to the first character in the string
myWideCharPtr := Addr(myWideString[1]);
// Display the string
ShowMessage(myWideCharPtr);
// Now increment the pointer
Inc(myWideCharPtr,2);
// And see what is shows now
ShowMessage(myWideCharPtr);
// Display all characters in the string
while i <= Length(myWideString) do
begin
ShowMessage(myWideCharPtr^);
Inc(i);
Inc(myWIdeCharPtr);
end;
end;
Show full unit code
Hello
llo