repeat loop and formatting question

Jim Ault JimAultWins at yahoo.com
Fri Nov 14 17:40:26 EST 2008


On 11/14/08 1:55 PM, "Mark Swindell" <mdswindell at cruzio.com> wrote:

> What would be the most efficient structure and syntax to achieve the
> following?:
> 
> A text field containing several paragraphs. I want to run through the
> field, finding and formatting certain strings, all occurrences of a
> list of certain letter combinations:
> 
> example, all occurrences of
> "ck" = bold
> "ch" = bold
> "oa" = underline
> "oo" = underline
>   etc.
> 
> The repeat loops I have tried run slowly and there are too many
> unnecessary passes (it seems).  I know there must be a more succinct,
> efficient statement that should work.
> 
Since you don't give any example of the code you are using, I am going to
make a few assumptions.  Try the idea of...
1) put the field into a variable
2) replace " ch " with "<font><bold> ch </bold></font>" in variableTxt
(note spaces around ' ch ' in order to locate only words)
.. and after all the replacements were completed,

set the htmlText of field "textBlock" to variableTxt

Hope this helps,

Jim Ault
Las Vegas





More information about the use-livecode mailing list