Description |
The StringToWideChar function converts a string SourceString into a WideString. It then copies TargetSize-1 characters from there to the TargetBuffer, adding a terminating 0 to the end.
|
|
Related commands |
|
|
|
Example code : A simple example |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses // The System unit does not need to be defined Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
wideChars : array[0..11] of WideChar;
myString : String;
begin // Set up our string
myString := 'Hello World';
// Copy to a WideChar format in our array
StringToWideChar(myString, wideChars, 12);
// Show what the copy gave
ShowMessage(WideCharToString(wideChars));
end; end.
|
Hide full unit code |
Hello World
|
|