For more information... RTFM!
NAVIGATION
RECENTLY VIEWED
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

pgbool

Return "f" (false) if the bidy text is either undefined, blank, "0", "f" or "false", otherwise return "t" (true).

The match is not case sensitive.

The "pgbooln" filter is the same as this one, except that it returns an undefined value if the body text is undefined.

Availability

Availability

This filter was introduced in version 5.4.0, and is therefore not available for use with any earlier Interchange version.

Example

  1. [filter pgbool]False[/filter]
  2. [filter pgbool]f[/filter]
  3. [filter pgbool][/filter]
  4. [filter pgbool]true[/filter]
  5. [filter pgbool]Kevin Walsh[/filter]

Results in:

  1. f
  2. f
  3. f
  4. t
  5. t

Source code

sub {
    my $val = shift;
    return 'f' if ! defined($val);
    $val =~ s/\s+//g;
    return 'f' if $val =~ /^(?:0|f(?:alse)?)?$/i;
    return 't';
}

Category:  Filters
Last modified by: Kevin Walsh
Modification date: Friday 23 February 2007 at 8:13 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us