|
I didn't see anyone mention using the SCAN op code. I know, everyone here seems to think /free is a must, but the %scan BIF is lacking something the good old op code gave us. You can populate an array with the positions of a search argument with a string using the SCAN op code. Take the following string. 'my_string_to_be_scanned_and_fill_array_with_positions_where_underscore_is' Using the following: C '_' SCAN ScanString Array The resulting array will contain the values 3,10,13,16,24,28,33,39,44,54,60,71,0,0,0,0,0,0,0,...... The number of elements in Array must equal the number of characters in ScanString. So to get the word 'where' as you requested, take the resulting array, do a LOOKUP for the first occurrence of a zero value, and subtract 2 from the index, save the element value in Y, subtract one more from the index, save the element value in X, then use the following to get the string you want: C EVAL WhatIWant = %subst(ScanString:X+1:Y-1) Note: I have not tested this, just did this off the top of my head. ****************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.