delete specified text?

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Jul 23 03:57:00 EDT 2014


Hi Richmond,

You can do this:

replace "plovdiv" with empty in line 2 of fld "PROCD"

Unfortunately, you'll end up with double space. You may need to add a 
space to "plovdiv" in the replace string or replace all double spaces at 
once:

replace space & space with space in fld "PROCD"

If you really only need to replace "Plovdiv", use this:

replace "Plovdiv" with empty in fld "PROCD"
repeat until space & space is not in fld "PROCD"
   replace space & space with space in fld "PROCD"
end repeat

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 7/23/2014 09:49, Richmond wrote:
> So; I have an urge to delete some text from lines of a list field, like
> this:
>
> put 1 into QOUNT
>     repeat until line QOUNT of fld "PROCD" is empty
>        delete word 2 of line QOUNT of fld "PROCD"
>        add 1 to QOUNT
>     end repeat
>
> which is all fine and dandy.
>
> The ONLY problem is that the word ('Plovdiv') that I want to remove from
> the lines of the list field is NOT always the second word . . .
>
> Ever a trier, I tried this:
>
> put 1 into QOUNT
>     repeat until line QOUNT of fld "PROCD" is empty
>        delete "Plovdiv" from line QOUNT of fld "PROCD"
>        add 1 to QOUNT
>     end repeat
>
> No joy . . .
>
> Now, I suppose I could have a routine that trots down the line checking
> if each word is 'Plovdiv',
> and if so, deleting it.
>
> Seems a bit wasteful and slow . . .
>
> -------------------------------------
>
> I t would be rather jolly if
>
> delete "Specific word" from line X of fld "Y"
>
> could be implemented.
>
> Richmond.





More information about the use-livecode mailing list