[fpc-pascal] FPC + Mobile development: the String type

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Jul 10 07:24:15 CEST 2014


Hi,

There is a discussion in the tiOPF newsgroups about adding Mobile
development support to the framework. A Delphi developer raised the
following issue with first experimentation.

Is this issue the same for FPC? ie: is the String type zero based for
mobile development?

=================================================
Creating a mobile app for iOS (and eventually Android) has hit the first
stumbling block: strings are zero based.

http://docwiki.embarcadero.com/RADStudio/XE5/en/Migrating_Delphi_Code_to_Mobile_from_Desktop

Example:
tiXML.pas has a method:
TtiXMLParser.ParseForAttributes(const AStr:String; pOnFind:
TtiOnXMLAttributeMethod);

This:
  for i:= 1 to lStrSize do

Needs to become:
  for i:= Low(AStr) to High(AStr)

This:
  lName := Copy(AStr, lStart+1, i - lStart - 1);

Needs to become:
  lName := AStr.Substring(lStart+1, i - lStart - 1);

etc.
=================================================



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/



More information about the fpc-pascal mailing list