extract by delimiter

Thomas McGrath III mcgrath3 at mac.com
Wed Dec 29 01:13:17 EST 2010


Very nice Jim. Thanks for the tips.

I still get hung up sometimes with the 1 to -1 . It's like my mind says isn't that like 0? Ha, and then I laugh and put it in anyway, but it is not the first thing that comes to mind.


-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgrath at comcast.net

On Dec 29, 2010, at 1:02 AM, Jim Ault wrote:

> To remove leading and trailing white space (space, tab...)
> 
>> repeat with x = 1 to the number of lines in tTemp
> 
>          put word 1 to -1 of line x of tTemp into line x of tTemp
>> end repeat
> 
> 
>>       if line x of tTemp is quote then delete line x of tTemp
> [use]    filter tTemp without quote
> 
>>       if line x of tTemp is "" then delete line x of tTemp
> [use]    filter tTemp without empty
> 
> 
>> By the way I tried all of the examples posted to better see what I was missing. I'm a visual oriented person and so I went with steps I could see. Only one problem in removing leading spaces, I took the lazy way out after getting confused again with multiple repeat loops etc.
>> 
>> So here is what I decided to use for now:
>> 
>> on mouseUp
>> 	put "http://weather.yahooapis.com/forecastrss?w=22664069&u=f" into tTempURL
>> 	put url tTempURL into field "Source"
>> 	put field 1 into tTemp
>> 	filter tTemp with "*yweather:*"
>> 	replace "<" with "" in tTemp
>> 	replace "/>" with "" in tTemp
>> 	replace "yweather:" with "" in tTemp
>> 	replace quote&space with quote&cr in tTemp -- Did the trick
>> 	repeat for 5 -- Lazy way to catch leading spaces
>>      		repeat with x = 1 to the number of lines in tTemp
>> 			if char 1 of line x of tTemp is space then delete char 1 of line x of tTemp
>>         		if line x of tTemp is quote then delete line x of tTemp
>>         		if line x of tTemp is "" then delete line x of tTemp
>>       	end repeat
>> 	end repeat
>> 	if last line of tTemp is "" then delete last line of tTemp
>> 	put tTemp into field "Result"
>> end mouseUp
>> 
>> I don't mind the quotes in the Result for my other code and I get a nice list of the info I need.
>> 
> 
> Jim Ault
> Las Vegas
> 
> 
> 
> _______________________________________________
> 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