extract by delimiter
    Jim Ault 
    jimaultwins at yahoo.com
       
    Wed Dec 29 01:02:40 EST 2010
    
    
  
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
    
    
More information about the use-livecode
mailing list