> I'm waiting for CFIndex code to become available in FBtoC
FBtoC's implementation of index$ is identical to CFIndex.incl and was
incorporated into FBtoC on 23 October 2006 (which predates its
appearance in FB!).
When including CFIndex.incl in an app, there's little reason to call
the CFIndexXxxx functions direct because the default setting is to
override FB's old index$ routines. The exception is fn CFIndexSort,
which doesn't have an index$ equivalent and was a later addition to
FB's header but overlooked for the FBtoC project.
This example *always* uses the CFIndex routines and runs via FB or
FBtoC:
'------------
#if ndef _FBtoC
include "CFIndex.incl"
#endif// def _FBtoC
dim as CFIndex count, i
window 1
// add
index$( 0 ) = "Delta"
index$( 1 ) = "Charlie"
index$( 2 ) = "Golf"
index$( 3 ) = "Alpha"
index$( 4 ) = "Echo"
index$( 5 ) = "Bravo"
// insert, replace, delete
index$ I( 1 ) = "Foxtrot"
index$( 1 ) = "FutureBASIC"
index$ D( 3 )
// show
count = mem( _numElem )
print : print "Count:";count
long if ( count )
for i = 0 to count - 1
print i,index$( i )
next i
end if
// find
print : print """Charlie"" found at element";indexf( "Charlie" )
// clear
clear index$ 0// <- must specify indexID (fixed in FBtoC 1.0.2)
print : print "Count:";mem( _numElem )
do
HandleEvents
until gFBQuit
'------------
Bernie