Search / replace

Kay C Lan lan.kc.macmail at gmail.com
Fri Feb 19 22:59:26 EST 2010


Glen,

I wasn't going to offer a 'full' script like Jim has, as the nature of
your data would effect the option taken.

You mentioned many lines of data, and a numeral followed by [ suggests
some kind of specific format. When dealing with many lines of similar
data, repeat for each line is normally considered the fastest way to
attack such a problem. If there were only one [ per line this would be
ideal and very fast. Even if there were mulitple [ per line, as Jim
has shown in his script offset() will return 0 if there are no [
found.

On the other hand if there is no format to the data, just a random
sprinkling of numerals followed by [, then Jim's offering will fit the
bill perfectly.

HTH

On Sat, Feb 20, 2010 at 11:44 AM, Glen Bojsza <gbojsza at gmail.com> wrote:
> Thanks Kay,
>
> I will play with offset but I think the trick will be covering each
> different number of ['s per line.
>
> Glen
>
> On Fri, Feb 19, 2010 at 8:20 PM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:
>
>> Hi Glen,
>>
>> look up offset in the Rev Dictionary.
>>
>> If you are sure that there is no possibility of a space between the
>> number and [, then something like this should work:
>>
>>  if (char (offset("[",tMyLine) - 1) of tMyLine is an integer) then
>>    --script to replace with "_"
>>  else
>>    --script to replace with empty
>>  end if
>>
>> HTH
>>
>>
>> On Sat, Feb 20, 2010 at 10:57 AM, Glen Bojsza <gbojsza at gmail.com> wrote:
>> > Sorry to bother everyone but either I'm tired or brain dead.
>> >
>> > I have a field which has hundreds of lines.
>> >
>> > For all [ in the field I need to check to see if the character to it's
>> > immediate left is a number.
>> >
>> > If it is a number then the [ is to be converted into an _.
>> >
>> > If it is not a number then the [ is to be removed (no substitution or
>> > spaces).
>> >
>> > I need to be able to cycle through the entire field which each line may
>> > contain several [.
>> >
>> > Any thoughts would be appreciated as I have tried using a combination of
>> > find characters and foundchunk on the field without success.
>> >
>> > thanks,
>> > _______________________________________________
>> > use-revolution mailing list
>> > use-revolution at lists.runrev.com
>> > Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> > http://lists.runrev.com/mailman/listinfo/use-revolution
>> >
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list