DelphiBasics
StringToWideChar
Function
Converts a normal string into a WideChar 0 terminated buffer System unit
 function StringToWideChar ( const SourceString : string; TargetBuffer : PWideChar; TargetSize : Integer ) : PWideChar;
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
WideCharToString Copies a null terminated WideChar string to a normal string
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : A simple example
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;
Show full unit code
   Hello World
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page