Recoding: search and replace

Tore Nilsen tore.nilsen at me.com
Wed Nov 16 16:20:20 CET 2016


I think this will be even faster. Put the script directly into a variable, use a repeat for structure and replace text as needed directly in the variable. You may not notice much of a speed improvement for smaller scripts, but if the script is longer, this should execute faster than your version, as both the "repeat for" structure is faster than the "repeat with" structure, and replacing the text in a variable rather than in the field, should also be faster.

Regards 
Tore
> 16. nov. 2016 kl. 13.13 skrev Richmond <richmondmathewson at gmail.com>:
> 
> So; here I am, as per usual, replying to my own message having found that nothing quite so elaborate was required:
> 
> /put empty into fld "fSSS1"//
> //   put the script of img "xxx" into fld "fSSS1"//
> //   put the number of lines of fld "fSSS1" into TERMINUS//
> //   put 1 into QOUNT//
> //   repeat until QOUNT > TERMINUS//
> //      if line QOUNT of fld "fSSS1" contains "unicodeText" then//
> //         put line QOUNT of fld "fSSS1" into PROCESST//
> //         put replaceText(PROCESST,"unicodeT","t") into line QOUNT of fld "fSSS1"//
> //      end if//
> //      if line QOUNT of fld "fSSS1" contains "useUnicode" then//
> //         put "--deprecated code removed (useUnicode)" into line QOUNT of fld "fSSS1"//
> //         end if//
> //         add 1 to QOUNT//
> //      end repeat//
> ///
> Richmond.
> 
> On 6.11.2016 14:44, Richmond wrote:
>> I wonder if there is a way to replace this:
>> 
>> set the unicodeText of fld "fDECODE" to (numToCodePoint(107) & numToCodePoint(104))
>> 
>> with this:
>> 
>> *put (numToCodePoint(107) & numToCodePoint(104)) into fld "fDECODE"*
>> 
>> where /(numToCodePoint(107) & numToCodePoint(104))/ vary?
>> 
>> I have no great urge to do that sort of thing manually about 6 million times.
>> 
>> Richmond.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list