Reference - PAD functions - contains


App: manual - Page: fragments/expressions_27


App: manual - Page: fragments/expressions_28


App: regression/errors - Page: eval/a_list_handed_to_a_pipe_function_as_its_parameter_is_named
PHP
HTML
eval/a_list_handed_to_a_pipe_function_as_its_parameter_is_named.pad
Result
[{echo 'abc' | contains(['a'])}]


App: regression/framework - Page: functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters
PHP
functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters.php
HTML
functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters.pad
Result
<?php

$subject
= 'Order 12, shipped';

?>
1[{echo 'Re: {$subject}' | url}] 2[{echo 'Re: {$subject}' | contains(',')}] 3[{echo 'Re: {$subject}' | replace(', ', ' - ')}] 4[{echo 'Re: {$subject}' | after(',')}] 5[{echo 'Re: {$subject}' | escape('js')}]


App: regression/framework - Page: functions/a_list_parameter_is_taken_where_the_function_takes_one
PHP
HTML
functions/a_list_parameter_is_taken_where_the_function_takes_one.pad
Result
1[{echo 'abc' | replace(['a', 'b'], ['x', 'y'])}] 2[{echo 'abc' | cut(['a', 'c'])}] 3[{echo 'b' | in(['a', 'b'])}] 4[{echo [1, 2] | contains(2)}] 5[{echo '' | default(['x', 'y']) | php:count}] 6[{echo 'b' in ('a', 'b')}]


App: regression/framework - Page: functions/contains_absent
PHP
HTML
functions/contains_absent.pad
Result
{echo 'hello world' | contains('mars')}


App: regression/framework - Page: functions/contains_over_a_number
PHP
HTML
functions/contains_over_a_number.pad
Result
{echo 12345 | contains('34')}


App: regression/framework - Page: functions/contains_present
PHP
HTML
functions/contains_present.pad
Result
{echo 'hello world' | contains('world')}


App: regression/framework - Page: functions/contains_tests_a_list_for_an_item
PHP
HTML
functions/contains_tests_a_list_for_an_item.pad
Result
{set $x = [1, 2, 3]/}[{if array:x contains 3}y{else}n{/if}][{if array:x contains 5}y{else}n{/if}][{if array:x not contains 2}y{else}n{/if}][{echo "hello" | contains("ell")}]


App: regression/framework - Page: lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty
PHP
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.php
HTML
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.pad
Result
<?php

// The lenient walk: a list where a pipe function wants a value as its parameter is empty.

$padCheckSyntax = FALSE;

?>
1[{echo 'abc' | contains(['a'])}] 2[{echo 'abc' like ['a']}] 3[{echo 'abc' | matches(['a'])}] 4[{echo 'abc' | after(['a'])}] 5[{echo 'abc' | left([1])}] 6[{echo 'abc' | truncate([2])}] 7[{echo 'abc' | escape(['js'])}] 8[{echo 'b' | between(['a'], 'z')}]


App: regression/pages - Page: catalog/functions
PHP
catalog/functions.php
HTML
catalog/functions.pad
Result
<?php

// The value the stripLow line cleans: printable letters around two control characters.

$catLow = "a\x01b\x02c";

?>
after:      {echo 'a/b' | after('/')}
afterLast: {echo 'a/b/c' | afterLast('/')}
before: {echo 'a/b' | before('/')}
beforeLast: {echo 'a.b.c' | beforeLast('.')}
between: {echo 17 | between(10, 66)}.
bold: {echo 'important' | bold}
close: {echo 'items' | close | ignore}
contains: {echo 12345 | contains('34')}.
cut: {echo 'banana' | cut('an')}
encodeHigh: {echo 'café' | encodeHigh}
exists: {echo 'hello/index.pad' | exists}.
html: {echo '<b>' | html}
in: {echo 'a' | in('a')}.
left: {echo 'abcdef' | left(2)}
like: {echo 'abc' | like('a%')}.
max_len: {echo 'abcdef' | max_len(4)}
mid: {echo 'abcdef' | mid(2, 3)}
nbsp: {echo 'hello world' | nbsp}
open: {echo 'items' | open | ignore}
optional: {$catNoSuch | optional}ok
range: {echo 50 | range(0, 100)}.
replace: {echo 'abc' | replace('b', 'x')}
right: {echo 'abcdef' | right(2)}
sanitize: {echo '<b>x</b>' | sanitize}
slashes: {echo "it's" | slashes}
stripLow: {echo $catLow | stripLow}
stripslashes: {echo "it's" | slashes | stripslashes}
tag: {echo 'items' | tag | ignore}
time: {echo 1702483200 | time('Y')}
timestamp: {echo 1702483200 | timestamp('Y')}
trim: {echo ' a b ' | trim}
ucwords: {echo 'hello world' | ucwords}
white: {echo 'a b' | white}