I didn't know this...

dunbarx at aol.com dunbarx at aol.com
Sat Dec 27 13:54:19 EST 2014


Hi,


The beauty of xTalk chunking expressions is that they do just this sort of thing. So if you had:


"ABCDEFG" in a field 1, you can just as easily:


-- replace "D" with empty in fld 1
-- delete char 4 of fld 1


or:


set the itemDel to "D"
put item 1 of fld 1 & item 2 of fld 1 into fld 1


Using the "offset" function would work as well, but is qualitatively different than chunking.


All depends on how you want to go about it. Thank the parsers. They understand how human beings think.


Craig



-----Original Message-----
From: Peter M. Brigham <pmbrig at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Sat, Dec 27, 2014 12:38 pm
Subject: I didn't know this...


Other people may already know this, but I just discovered that you can do 
something like:

put "12.34.56.78" into p
replace "." with empty in char 4 to -1 of p

and sure enough, you get "12.345678"

I did not know that the replace command can work on a chunk within a variable. 
The documentation doesn't reflect this.

It only takes small things to make me happy.  :-)

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


_______________________________________________
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