[fpc-pascal] Generic String Functions
Sven Barth
pascaldragon at googlemail.com
Fri Feb 28 17:06:23 CET 2014
Am 28.02.2014 15:42, schrieb Michael Schnell:
> On 02/28/2014 03:00 PM, Sven Barth wrote:
>> As long as not stated differently AnsiString and UnicodeString are
>> meant as implemented in FPC trunk.
> Can you point me to a _final_ documentation on this ?
Work on final documentation will be started when 2.8/3.0 will be
released. Till then wiki.freepascal.org/FPC_Unicode_Support can be
considered the documentation. Please note that the non existance of a
documentation does not mean that a feature is not considered final. And
the new string type is working as it should, what's still left is to
adjust the RTL for more Ansi-/UnicodeString awareness.
> Of course I know how this works (otherwise this discussion would not
> make any sense at all) that the implementation of the string record
> allows for this, but Embarcadero does not allow the users to decently
> take advantage of it.
> - "non-Raw" does not allow for modifying the type and code-length fields
Yes, but you can always do it by converting to RawByteString:
=== code begin ===
function ChangeCodePage(aStr: RawByteString; aCodePage:
TSystemCodePage): RawByteString;
begin
Result := aStr;
SetCodePage(Result, aCodePage, False);
end;
var
s: UTF8String;
begin
s := 'Hello World';
Writeln(StringCodePage(s));
s := ChangeCodePage(s, CP_ACP);
Writeln(StringCodePage(s));
end.
=== code end ===
=== output begin ===
65001
0
=== output end ===
Regards,
Sven
More information about the fpc-pascal
mailing list