PHP code example of piyo2 / str

1. Go to this page and download the library: Download piyo2/str library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

piyo2 / str example snippets


$filter = (new Str())->trim()
	->noNewlines()
	->hankakuDigits()
	->hiragana();

$filter->applyTo(" A03 \nアイス\n");
// => "A03 アイス"

(new Str())->trim()
	->hankaku()
	->fn(fn ($s) => '#' . $s)
	->applyTo(' 123');
// => "#123"

(new Str())->applyTo("\0\n");
// => "\n"

(new Str(true))->applyTo("\0\n");
// => "\0\n"