How to test if a field does not contain anything else than returns or tab?

Ken Ray kray at sonsothunder.com
Wed Feb 4 13:00:30 EST 2009




On 2/4/09 8:41 AM, "Andre.Bisseret" <Andre.Bisseret at inria.fr> wrote:

> Hello
> Thanks to all who paid attention to my question
> Quite a nice number  of ways (mainly variations around counting the
> number of words)

BTW, just for 100% clairty, none of these "word-based" approaches work if
there is a non-breaking space (  or  ) in the field.  Admittedly,
the possibility of this happening is extremely low, but to be on the safe
side, this is "trim" function I use:

function trim what
  if the platform is "MacOS" then
    replace numToChar(202) with " " in what
  else
    replace numToChar(160) with " " in what
  end if
  return (word 1 to -1 of what)
end trim

So for testing an empty field, it would be:

  if trim(fld 1) = "" then

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