Bill Stewart (bstewart AT iname.com)
WindowsString.pp is covered by the GNU Lesser Public License (LPGL). See the file LICENSE for details.
WindowsString.pp is a Free Pascal (FPC) unit for the Windows platform that contains string functions handled by Windows API calls.
This section documents the functions in the unit.
Converts an AnsiString string to a UnicodeString string using the MultiByteToWideChar API.
function AnsiToUnicodeString(const AnsiStr: AnsiString; const CodePage: UINT): UnicodeString;
AnsiStr - Specifies the AnsiString string to be converted to a UnicodeString string.
CodePage - Specifies the code page for the conversion. Usually, this will be CP_ACP or CP_OEM.
The AnsiString string AnsiStr converted to a UnicodeString string. If the conversion fails, the function returns an empty UnicodeString string.
See the Windows API documentation for the MultiByteToWideChar API for more information about the CodePage parameter.
Converts a UnicodeString string to an AnsiString string using the WideCharToMultiByte API.
function UnicodeStringToAnsi(const UnicodeStr: UnicodeString; const CodePage: UINT): AnsiString;
UnicodeStr - Specifies the UnicodeString string to be converted to an AnsiString string.
CodePage - Specifies the code page for the conversion. Usually, this will be CP_ACP or CP_OEM.
The UnicodeString string UnicodeStr converted to an AnsiString string. If the conversion fails, the function returns an empty AnsiString string.
See the Windows API documentation for the WideCharToMultiByte API for more information about the CodePage parameter.
Returns a UnicodeString string with environment variable references expanded using the ExpandEnvironmentStrings API.
function ExpandEnvStrings(const UnicodeStr: UnicodeString): UnicodeString;
UnicodeStr - Specifies the UnicodeString string containing environment variable references (e.g., %variablename%).
The UnicodeString string UnicodeStr with environment variable references expanded.
Environment variable references are environment variable names surrounded by % characters (e.g., %variablename%). For each such reference, the function replaces the %variablename% portion with the current value of the named environment variable. Environment variable names between % characters are not case-sensitive. If the function does not find an environment variable name, it does not expand that portion of the string.
Returns a UnicodeString string in lowercase using the LCMapStringW API.
function LowercaseString(const UnicodeStr: UnicodeString): UnicodeString;
UnicodeStr - Specifies the UnicodeString string to be returned as lowercase.
The UnicodeString string UnicodeStr in lowercase. If the case mapping fails, the function returns an empty UnicodeString string.
Returns a UnicodeString string in uppercase using the LCMapStringW API.
function UppercaseString(const UnicodeStr: UnicodeString): UnicodeString;
UnicodeStr - Specifies the UnicodeString string to be returned as uppercase.
The UnicodeString string UnicodeStr in uppercase. If the case mapping fails, the function returns an empty UnicodeString string.
Tests whether two UnicodeString strings match case-insensitively using the CompareStringW API.
function SameString(const UnicodeStr1, UnicodeStr2: UnicodeString): Boolean;
UnicodeStr1 - Specifies the first UnicodeString string to compare.
UnicodeStr2 - Specifies the second UnicodeString string to compare.
The function returns true if the strings match, or false otherwise. The match is not case-sensitive.