Replacing Characters

JB sundown at pacifier.com
Sat Sep 27 03:23:08 EDT 2014


Another thing to consider is the characters are
not in any specific crder.  It could be cfacded or
anything else.

If is use a repeat for each char and the variable
as a counter that resets every three times then
I only need to make one pass through to make
the changes.  But there might be a faster way.

John Balgenorth


On Sep 26, 2014, at 11:31 PM, JB <sundown at pacifier.com> wrote:

> Thanks, Kay!
> 
> The problem is there are no delimiters.  It
> is a string of only chars A to F and there
> are no spaces etc.
> 
> John Balgenorth
> 
> 
> On Sep 26, 2014, at 11:19 PM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:
> 
>> Assuming tBigList contains your data and it is a tab separated list.
>> 
>> set the itemDelimiter to tab
>> repeat for each item tSearchThis in tBigList
>> if (char 3 of tSearchThis = "D") then
>>  put "+" into char 3 of tSearchThis
>> end if
>> put tSearchThis & tab after tNewList
>> end repeat
>> --remove the trailing tab
>> put word 1 to -1 of tNewList into tNewList
>> set the itemDelimiter to comma
>> 
>> tNewList should now be your corrected list
>> 
>> HTH
>> 
>> On Sat, Sep 27, 2014 at 12:26 PM, JB <sundown at pacifier.com> wrote:
>>> I want to replace every third character in
>>> a text string if it is a certain character.  So
>>> lets say I have a list of characters there
>>> range from A thru F and the list is possibly
>>> 10,000 characters long.
>>> 
>>> I want to check every third character in the
>>> list and if it is a D then I want to change it
>>> to a +.
>>> 
>>> I can probably do it with a repeat and use a
>>> variable for a counter that resets every three
>>> times and then check the character when the
>>> counter gets to three but I was wondering if it
>>> could be done faster somehow.
>>> 
>>> John Balgenorth
>>> 
>>> _______________________________________________
>>> 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
>> 
>> _______________________________________________
>> 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
>> 
> 
> 
> _______________________________________________
> 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