Strtok and/or instr

Nancy Palmquist nancy.palmquist at vss3.com
Tue Dec 22 14:12:03 PST 2020


Richard,

I use instr quite a bit and the number returned is always from the 
beginning, even if you start in the middle of the string to look.

So if I had a string that has:

xx="<Name>George Jetson</Name>"

If you do instr(xx,"Name","1")  you will get "2"
If you do instr(xx,"Name,"3") you will get "22" (If I counted right)

I use this for taking apart strings all the time and this is how the 
math works.

Nancy

On 12/16/2020 12:56 PM, Richard Kreiss via Filepro-list wrote:
> Field="Quick Brown Fox behind A tree"
>
> QQ=instr(field,"B"); in this case QQ will equal "7" as the first B (Brown) is in the seventh position.  If qq=instr,"B","8") is the value of qq "17" which is the value from the starting position or 10 the value from the
>
> Both these functions yield the first occurrence of a value. Instr(field,"A",{optional starting point]).  So, my question is if field has more than one iteration of "A", and the optional starting point is set past where "A" first appears in the 10th position.  Will the next iteration of "A" be at "10, which is the value formn where the search started?.
>
> This would also be same thing for strtok() with regards to position of the value found.
>
> Yes, I could test this out but I thought you all might want to thing about it as you might be using these functions and the manual is not clear on this subject except to indicate that one may need to move the starting point of the search forward of the point of the first occurrence if the value being searched for occurs more than once.
>
>
> Richard Kreiss
> GCC Consulting
>
>
>
>
>
>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: winmail.dat
> Type: application/ms-tnef
> Size: 13896 bytes
> Desc: not available
> URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20201216/4fae277c/attachment.bin>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list

-- 
Nancy Palmquist         MOS & filePro Training Available
Virtual Software Systems    Web Based Training and Consulting
PHONE: (412) 835-9417           Web site:  http://www.vss3.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20201222/cbfb8c2d/attachment.html>


More information about the Filepro-list mailing list