[fpc-pascal] How to know the string type of a variable?

Juha Manninen juha.manninen62 at gmail.com
Mon Dec 30 18:19:20 CET 2013


On Mon, Dec 30, 2013 at 2:35 PM, Marcos Douglas <md at delfire.net> wrote:
> Is possible to know what string type of a variable (AnsiString,
> UTF8String, RawByteString, etc)?

When UTF-8 encoded string is stored in AnsiString (as in LCL), this
test should tell you if it actually is UTF-8 string:
  if Length(s) <> UTF8Length(s) then
  begin
    // UTF-8
  end;

It should allow a mixture of ansi- and UTF-8 strings in your data.

Juha



More information about the fpc-pascal mailing list