<?php

include '../src/unreal4u/stringOperations.php';
$stringOperations = new unreal4u\stringOperations();
echo '<pre>';
$contentString = file_get_contents('lorem-ipsum.txt');
$text = $stringOperations->truncate($contentString);
print_r($text);
echo '<br />' . str_repeat('-', 80) . '<br />';
$string = 'hello bye';
$text = $stringOperations->truncate($string, 8);
print_r($text);
echo '<br />' . str_repeat('-', 80) . '<br />';
$text = $stringOperations->truncate($contentString, 650, ' ');
print_r($text);
echo '<br />' . str_repeat('-', 80) . '<br />';
echo '</pre>';
$testArray = array('Cañete', 'Föllinge', 'ÑÖÑÚ', '漢A字BC', '汉A字BC', '𠜎𠜱𠝹𠱓');
$stringOperations->maximumDeviation = 0;
$output = array();
foreach ($testArray as $testString) {
    $output[$testString] = $stringOperations->truncate($testString, 3, '', '');
}
var_dump($output);
$input = 'Hello, this must be some spectacular -a: test-';
var_dump(mb_strlen($input));
$stringOperations->maximumDeviation = 10;
$firstOutput = $stringOperations->truncate($input, 37, array('-', ':', ' '));
$secondOutput = $stringOperations->truncate($input, 37, array(':', '-', ' '));
var_dump($firstOutput);
// Should give: Hello, this must be some spectacular ...
<?php

include '../src/unreal4u/stringOperations.php';
$testEmails = array('*****@*****.**', '+%22My%22+%3Cmy%40name.com%3E', '=?utf-8?B?5L2p5ae/?= <*****@*****.**>', 'My Name <*****@*****.**>', '=?ISO-8859-1?Q?B=F8lla?=, med =?ISO-8859-1?Q?=F8l?= i baggen');
$stringOperations = new unreal4u\stringOperations();
$output = array();
foreach ($testEmails as $testEmail) {
    $output[] = $stringOperations->mimeHeaderDecode($testEmail);
}
var_dump($output);
<?php

include '../src/unreal4u/stringOperations.php';
$stringOperations = new unreal4u\stringOperations();
$result = $stringOperations->createSlug(__FILE__);
var_dump($result);
$result = $stringOperations->createSlug(__FILE__, false);
var_dump($result);
$result = $stringOperations->createSlug('th3/$3 áin\'t n0 vá/lïd char$...');
var_dump($result);
$result = $stringOperations->createSlug('Th3/$3 ÁiN\'t n0 Vá/lÏd ch4R$...', false);
var_dump($result);
echo $stringOperations;
<?php

include '../src/unreal4u/stringOperations.php';
$testEmails = array('*****@*****.**', '+%22My%22+%3Cmy%40name.com%3E', '=?utf-8?B?5L2p5ae/?= <*****@*****.**>', 'My Name <*****@*****.**>');
$stringOperations = new unreal4u\stringOperations();
$output = array();
foreach ($testEmails as $testEmail) {
    $output[] = $stringOperations->decomposeCompleteEmail($testEmail);
}
var_dump($output);