Sort of a problem

Peter M. Brigham, MD pmbrig at gmail.com
Sat May 12 12:22:38 EDT 2012


If you have streets like "SW 34th St" you'll have a problem -- you should probably adjust your pickStreet function:

function pickStreet pName
   if word 1 of pName is among the words of "N S E W NE NW SE SW" then
      return word 2 to -1 of pName
   end if
   return pName
end pickStreet

-- Peter

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

On May 11, 2012, at 2:09 PM, Jim Hurley wrote:

> Thanks Jerry. That is what I was looking for.
> 
> There is some magic going on behind the scenes with that "by ... of each" that I never really caught on to.
> 
> Jim
> 
> 
>> Date: Thu, 10 May 2012 21:23:36 -0700
>> From: Jerry Jensen <jhj at jhj.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Sort of a problem
>> 
>> This seems to do the job. No polish, but you'll get the idea.
>> .Jerry
>> 
>> Aw, crap, forgot about no attachments. Here's the code:
>> 
>> ------------------------------------------------
>> 
>> on mouseUp
>>  local tList
>>  put fld "Streets" into tList
>>  sort lines of tList by pickStreet(each)
>>  put tList into fld "Streets"
>> end mouseUp
>> 
>> function pickStreet pName
>>  if word 1 of pName is in "NSEW" then
>>     return word 2 to -1 of pName
>>  else
>>     return pName
>>  end if
>> end pickStreet
>> 
>> -----------------------------------------------------




More information about the Use-livecode mailing list