Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

is_string

Summary

Returns TRUE if the provided variable is a string.

Usage

input|is_string( target )

Parameters

NameTypeDescriptionRequired
target any The target variable. Only if the input parameter is omitted.

Returns

TRUE or FALSE.

Description

This operator checks if the input parameter or the target variable is a string. If it is, the operator will return TRUE, otherwise FALSE will be returned. If both the input parameter and the target variable are provided, it is the target variable that will be evaluated.

Examples

Example 1

{def $my_variable='Commodore'}
 
{if $my_variable|is_string()}
    It is a string.
{else}
    It is not a string.
{/if}

The following output will be produced: "It is a string.".

Example 2

{def $my_variable='Amiga'}
 
{if is_string( $my_variable )}
    It is a string.
{else}
    It is not a string.
{/if}

The following output will be produced: "It is a string.".

Example 3

{def $a='C64'
     $b=128}
 
{if $a|is_string( $b )}
    It is a string.
{else}
    It is not a string.
{/if}

The following output will be produced: "It is not a string.".

Balazs Halasy (05/02/2004 12:36 pm)

Balazs Halasy (06/05/2005 7:29 am)


Comments

There are no comments.