NAME

CTK::TFVals - True & False values conversions

VERSION

Version 1.01

SYNOPSIS

use CTK::TFVals;

# Undef conversions
uv2zero( $value ); # Returns 0 if value is undef
uv2null( $value ); # Returns "" if value is undef (null/empty/void)
                   # Aliases:  uv2empty, uv2void

# False conversions
fv2undef( $value ); # Returns undef if value is false
fv2zero( $value ); # Returns 0 if value is false
fv2null( $value ); # Returns "" if value is false (null/empty/void)
                   # Aliases:  fv2empty, fv2void

# True conversions
tv2num( $value ); # Returns 0 unless value ~ ([+-])?\d+
                  # Aliases: tv2number
                  # Check-function: is_num
tv2flt( $value ); # Returns 0 unless value ~ ([+-])?\d+\.?\d*
                  # Aliases: tv2float
                  # Check-function: is_flt
tv2int( $value ); # Returns 0 unless value ~ \d{1,11}
                  # Returns 0 unless value >= 0 && < 99999999999
                  # Check-function: is_int
tv2int8( $value ); # Returns 0 unless value >= 0 && < 255
                   # Check-function: is_int8
tv2int16( $value ); # Returns 0 unless value >= 0 && < 65535
                    # Check-function: is_int16
tv2int32( $value ); # Returns 0 unless value >= 0 && < 4294967295
                    # Check-function: is_int32
tv2int64( $value ); # Returns 0 unless value >= 0 && < 2**64
                    # Check-function: is_int64
tv2intx( $value, $x ); # Returns 0 unless value >= 0 && < 2**$x
                    # Check-function: is_intx

DESCRIPTION

True & False values conversions

FUNCTIONS

uv2zero

This function returns the 0 value if argument is undef.

uv2zero( $value );
uv2null

This function returns the "" value if argument is undef.

uv2null( $value );
uv2empty

See "uv2null"

uv2void

See "uv2null"

fv2undef

This function returns the undev value if argument is false.

fv2undef( $value );
fv2zero

This function returns the 0 value if argument is false.

fv2zero( $value );
fv2null

This function returns the "" value if argument is false.

fv2null( $value );
fv2empty

See "fv2null"

fv2void

See "fv2null"

tv2num

This function returns the 0 value unless argument ~ ([+-])?\d+

tv2num( $value );
tv2number

See "tv2num"

tv2flt

This function returns the 0 value unless argument ~ ([+-])?\d+\.?\d*

tv2flt( $value );
tv2float

See "tv2flt"

tv2int

This function returns the 0 value unless argument ~ \d{1,11} and argument value > 0 && < 99999999999

tv2int( $value );
tv2int8

This function returns the 0 value unless argument value >= 0 && < 255

tv2int8( $value );
tv2int16

This function returns the 0 value unless argument value >= 0 && < 65535

tv2int16( $value );
tv2int32

This function returns the 0 value unless argument value >= 0 && < 4294967295

tv2int32( $value );
tv2int64

This function returns the 0 value unless argument value >= 0 && < 2**64

tv2int64( $value );
tv2intx

This function returns the 0 value unless argument value >= 0 && < 2**$x

tv2int64( $value, $x );
is_num

This function returns true if argument ~ ([+-])?\d+

is_num( $value );
is_flt

This function returns true if argument ~ ([+-])?\d+\.?\d*

is_flt( $value );
is_int

This function returns true if argument ~ \d{1,20} and argument value >= 0 && < 99999999999999999999

is_int( $value );
is_int8

This function returns true if argument value >= 0 && < 255

is_int8( $value );
is_int16

This function returns true if argument value >= 0 && < 65535

is_int16( $value );
is_int32

This function returns true if argument value >= 0 && < 4294967295

is_int32( $value );
is_int64

This function returns true if argument value >= 0 && < 2**64

is_int64( $value );
is_intx

This function returns true if argument value >= 0 && < 2**$x

is_intx( $value, $x );

TAGS

ALL

Export all subroutines:

"uv2zero", "uv2null", "uv2empty", "uv2void", "fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void", "tv2num", "tv2number", "is_num", "tv2flt", "tv2float", "is_flt", "tv2int", "is_int", "tv2int8", "is_int8", "tv2int16", "is_int16", "tv2int32", "is_int32", "tv2int64", "is_int64", "tv2intx", "is_intx"

DEFAULT

"uv2zero", "uv2null", "uv2empty", "uv2void", "fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void", "tv2num", "tv2int", "tv2flt"

UNDEF

"uv2zero", "uv2null", "uv2empty", "uv2void"

FALSE

"fv2undef", "fv2zero", "fv2null", "fv2empty", "fv2void"

TRUE

"tv2num", "tv2number", "tv2flt", "tv2float", "tv2int", "tv2int8", "tv2int16", "tv2int32", "tv2int64", "tv2intx"

CHCK

"is_num", "is_flt", "is_int", "is_int8", "is_int16", "is_int32", "is_int64", "is_intx"

SEE ALSO

CTK

AUTHOR

Sergey Lepenkov (Serz Minus) http://www.serzik.com <minus@mail333.com>

COPYRIGHT

Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.

This program is distributed under the GNU LGPL v3 (GNU Lesser General Public License version 3).

See LICENSE file