Reference - PAD functions - trim


App: manual - Page: fragments/expressions_34


App: manual - Page: fragments/expressions_39


App: manual - Page: fragments/expressions_4
PHP
HTML
fragments/expressions_4.pad
Result
{set $name = '  ada lovelace  '}
<p>{$name | trim | ucwords}</p>
{data 'langs'}["php", "sql", "pad"]{/data}
<p>{langs}{$langs} {/langs | upper}</p>


App: manual - Page: fragments/pipes_3
PHP
fragments/pipes_3.php
HTML
fragments/pipes_3.pad
Result
<?php

$rawText
= ' hello world ';
$message = 'the quick brown fox';

?>
<p>Chain multiple pipes together:</p>

<p>Original: [{$rawText}]</p>
<p>Trimmed and uppercase: [{echo $rawText | trim | upper}]</p>

<p>Original: {$message}</p>
<p>Uppercase first letter of each word: {echo $message | ucwords}</p>
<p>Replace and capitalize each word: {echo $message | replace('fox', 'dog') | ucwords}</p>


App: regression/errors - Page: eval/a_list_handed_to_a_text_function_is_named
PHP
HTML
eval/a_list_handed_to_a_text_function_is_named.pad
Result
{echo 'a, b' | php:explode(',', @) | trim}


App: regression/errors - Page: eval/a_pipe_function_given_a_parameter_it_does_not_take_is_named
PHP
HTML
eval/a_pipe_function_given_a_parameter_it_does_not_take_is_named.pad
Result
{echo ',a,' | trim(',')}


App: regression/framework - Page: check/fragments_pipes_3
PHP
check/fragments_pipes_3.php
HTML
check/fragments_pipes_3.pad
Result
<?php

$rawText
= ' hello world ';
$message = 'the quick brown fox';

?>
<p>Chain multiple pipes together:</p>

<p>Original: [{$rawText}]</p>
<p>Trimmed and uppercase: [{echo $rawText | trim | upper}]</p>

<p>Original: {$message}</p>
<p>Uppercase first letter of each word: {echo $message | ucwords}</p>
<p>Replace and uppercase: {echo $message | replace('fox', 'dog') | ucwords}</p>


App: regression/framework - Page: escaping/an_opening_pipe_keeps_the_tags_of_the_content
PHP
escaping/an_opening_pipe_keeps_the_tags_of_the_content.php
HTML
escaping/an_opening_pipe_keeps_the_tags_of_the_content.pad
Result
<?php $v = '{echo (7 + 7)}'; ?>
{data 'n'}[{"name":"a"},{"name":"b"}]{/data}[{n | trim}  <li>{$name}</li>  {/n}][{n | @ . $v}<{$name}>{/n}][{n | ignore}{$name}{/n}]


App: regression/framework - Page: expressions/a_built_in_written_as_a_call_reads_its_first_argument
PHP
HTML
expressions/a_built_in_written_as_a_call_reads_its_first_argument.pad
Result
{set $s = 'hello'}[{echo trim('  a  ')}][{echo upper($s)}][{echo left($s, 2)}][{if upper($s) eq 'HELLO'}T{else}F{/if}][{echo 'x' . upper($s)}][{echo date('Y', 0)}][{echo $s | replace('l', upper('x'))}][{echo substr($s, 0, 3)}][{echo $s | left(2)}][{$s | left(3)}]


App: regression/framework - Page: expressions/a_call_in_a_list_item_keeps_the_items_before_it
PHP
HTML
expressions/a_call_in_a_list_item_keeps_the_items_before_it.pad
Result
{echo php:json_encode([3, upper('x'), [1, 2], trim(' y ')])} {echo php:json_encode(['a' => 1 ? 'b' : 'c', 'd' => left('xyz', 2)])}


App: regression/framework - Page: expressions/a_pipe_inside_brackets_belongs_to_the_group
PHP
HTML
expressions/a_pipe_inside_brackets_belongs_to_the_group.pad
Result
{set $n = 3/}{set $s = 'ab'/}[{echo ($n | + 1) * 2}][{echo upper(' hi ' | trim)}][{if ($n | + 1) eq 4}y{/if}][{echo php:max(1, $n | + 1)}][{echo php:implode(',', [$n | + 1, $n])}][{$s | php:str_pad(@ | upper, 4, '*')}][{echo $s | (@ | upper) . @}][{echo ($n | (@ | * 2))}]


App: regression/framework - Page: expressions/a_printf_format_inside_brackets_formats_the_value_piped_into_it
PHP
HTML
expressions/a_printf_format_inside_brackets_formats_the_value_piped_into_it.pad
Result
{set $n = 3/}[{echo (1.25 | %.1f)}][{echo php:strlen(1.25 | %.1f)}][{echo php:implode('-', [1 | %02d, 2 | %02d])}][{echo (7 | %'*5d)}][{echo ($n | %.2f | trim) . '!'}][{echo ($n | % 2)}]


App: regression/framework - Page: expressions/a_test_after_a_function_without_brackets_tests_its_answer
PHP
HTML
expressions/a_test_after_a_function_without_brackets_tests_its_answer.pad
Result
[{echo 'Hello' | lower in ('hello')}][{echo 'Hello' | lower in ('x')}][{echo 'abc' | php:strlen in (3)}][{echo 'ab ' | trim like 'ab'}]


App: regression/framework - Page: functions/a_null_handed_along_a_pipe_chain_is_empty_to_the_next_function
PHP
HTML
functions/a_null_handed_along_a_pipe_chain_is_empty_to_the_next_function.pad
Result
[{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | trim}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | html}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | left(3)}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | replace('a', 'b')}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | url}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | default('none')}]


App: regression/framework - Page: functions/a_printf_format_is_read_in_any_pipe_segment
PHP
HTML
functions/a_printf_format_is_read_in_any_pipe_segment.pad
Result
{set $p = 10}{set $n = 5}[{echo $p | * 1.21 | %.2f}][{$p | * 1.21 | %.2f}][{echo $n | + 1 | %05.2f}][{echo $n | %05.2f | trim}][{echo $p | %.2f | . ' EUR'}][{$n | %s apples | upper}][{echo $n | %'*6s | . 'x'}][{echo $n | % 3}]