last char

Ken Ray kray at sonsothunder.com
Sun Jan 21 18:04:32 EST 2007


On Sun, 21 Jan 2007 23:39:46 +0100 (MET), Klaus Major wrote:

> Hi Robert,
> 
>> I have a list that is separated by commas and need to check to make sure
>> that the last char is not a comma I tried this but does not remove the
>> comma, it does however see that the last char is a comma, just not sure how
>> to remove it?
>> 
>> 
>> IF last char of colnames is comma THEN
>        delete last char of colnames
>>  END IF

Yeah, I have a generic fuction called "KLC" (kill last character) that 
does it... like this:

  put KLC(colnames,",") into colnames


function KLC pWhat, pChar
  if char -1 of pWhat = pChar then delete char -1 of pWhat
  return pWhat
end KLC

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list