Re hashing tip

Richard Kreiss rkreiss at gccconsulting.net
Tue Jan 15 08:10:51 PST 2008


The other day I posted an inquiry if there was an easier way to find the
location of a given character in a string value

 fn=Name_clean.csv.

There were 2 suggestions, one being using mid(fn,ct,"1") and keep testing
for _.

However, in looking Stuart Werner's filePro Developers Reference 4th
addition, I came across a function which simplifies this to 1 line of code:
		qq=strtok(fn,"_","1")	returns the position of the first
occurrence, in a string, of any one of a group of characters.

In the above example qq=5.

For my purpose dn=mid(fn"1",qq-"1"). So dn=name 
 
In his example qq=strtok(jj,"1234567890","5") finds the first number after
the 5th position in jj.

It will return a 0 if the value doesn't exist.

Stuart notes that this function will seek and of a group of characters not
just one as INSTR.

Hope this may help in some future programming.


Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
  








More information about the Filepro-list mailing list