replaceText

Richmond Mathewson richmondmathewson at gmail.com
Sun Jun 7 17:11:56 EDT 2009


There are 2 schools of thought about this sort of problem:

1. The elegant code school.

2. The garden spade school.

I belong to the second; as I am not unduly worried about the
fact that a couple of extra lines of code may add a few micro-seconds
to the time taken for it to execute. Hence the "Dunno".

And, while on that topic, a type 1 person might ask why you are
storing your strings in fields at all when they could reside in either
a string variable or a custom property; either of which would allow
code execution to take place much more rapidly.

I am also somebody who likes to stir the pot a bit.  :)

-= JB =- wrote:
> Got it working, thanks
> I was concerned if it would find the text if it had other characters
> on each side instead of spaces and like you say it works.
>
> -=>JB=-
>
>
> On Jun 7, 2009, at 1:46 PM, Richmond Mathewson wrote:
>
>> I don't think Runtime Revolution as such parses
>> words the way human beings do, it will replace
>> any string (or part thereof) with any other string.
>>
>> For the sake of argument try this:
>>
>> on mouseUp
>>  put "id=d2b516" into oldWord
>>  put "id=xyz59wk" into newWord
>>  if fld id 1004 contains "id=d2b516" then
>>    replace oldWord with newWord in fld id 1004
>>  end if
>> end mouseUp
>>
>>
>> -= JB =- wrote:
>>> Will this work if it needs to be characters and not words?
>>> I will give it a try and get back with you.
>>>
>>> -=>JB<=-
>>>
>>>
>>> On Jun 7, 2009, at 1:19 PM, Richmond Mathewson wrote:
>>>
>>>> Dunno what all the fuss is about;
>>>>
>>>> this works:
>>>>
>>>> on mouseUp
>>>>  put "id=d2b516" into oldWord
>>>>  put "id=anything" into newWord
>>>>  if fld id 1004 contains "id=d2b516" then
>>>>    replace oldWord with newWord in fld "fSTUFF"
>>>>    end if
>>>> end mouseUp
>>>>
>>>> -= JB =- wrote:
>>>>> Below is a piece of text from the field,
>>>>>
>>>>> /link.php?&gr=1&id=d2b516&url=/ftt/
>>>>>
>>>>> I will be replacing id=d2b516 with id=anything
>>>>>
>>>>> -=>JB<=-
>>>>>
>>>>>
>>>>> On Jun 7, 2009, at 1:00 PM, Mark Schonewille wrote:
>>>>>
>>>>>> JB, can you post a piece of the text you are modifying?
>>>>>>
>>>>>> -- Best regards,
>>>>>>
>>>>>> Mark Schonewille
>>>>>>
>>>>>> Economy-x-Talk Consulting and Software Engineering
>>>>>> http://economy-x-talk.com
>>>>>> Snapper Screen Recorder 2.0.1 http://snapper.economy-x-talk.com
>>>>>>
>>>>>> If you sent me an e-mail before 15 May and haven't got a reply 
>>>>>> yet, please send me a reminder.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 7 jun 2009, at 21:55, -= JB =- wrote:
>>>>>>
>>>>>>> In the code below the reason I delete chars is because I am 
>>>>>>> actually replacing
>>>>>>> the same line twice but the first time that line has id= before 
>>>>>>> it with no .jpg while
>>>>>>> the second time it has thumbs/ before it and a .jpg after.
>>>>>>>
>>>>>>> Any ideas on how to accomplish this task?
>>>>>>>
>>>>>>> -=>JB<=-
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>
>>> _______________________________________________
>>> 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