On Mon, Dec 30, 2013 at 9:41 AM, Michael Van Canneyt <mich...@freepascal.org> wrote: > > > On Mon, 30 Dec 2013, Marcos Douglas wrote: > >> Hi, >> >> Is possible to know what string type of a variable (AnsiString, >> UTF8String, RawByteString, etc)? > > > You can try > > if TypeInfo(S)=TypeInfo(AnsiString) then > > etc. > > The following program > > procedure t(S : String); > > begin > if typeinfo(s)=typeinfo(shortstring) then > Writeln('ShortString') > else > Writeln('Ansistring'); end; > > begin > t(''); > end. > > Prints ShortString if compiled as-is (fpc mode), and prints AnsiString if > compiled with -S2h (objfpc mode, string=ansistring)
TypeInfo! I was trying using "type(s)", "s is AnsiString"... I forgot. Thank you. Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal