<?php $t = new \org\rhaco\flow\module\Helper(); eq("00005", $t->zerofill(5, 5)); eq("5", $t->zerofill(5));
<?php $t = new \org\rhaco\flow\module\Helper(); eq('on', $t->cond_switch(true, 'on', 'off')); eq('off', $t->cond_switch(false, 'on', 'off')); eq('off', $t->cond_switch('', 'on', 'off')); eq('off', $t->cond_switch(0, 'on', 'off')); eq('off', $t->cond_switch(false, 'on', 'off')); eq('off', $t->cond_switch(array(), 'on', 'off')); eq('on', $t->cond_switch('1', 'on', 'off')); eq('on', $t->cond_switch(1, 'on', 'off')); eq('on', $t->cond_switch(true, 'on', 'off')); eq('on', $t->cond_switch(array(1), 'on', 'off'));
<?php $t = new \org\rhaco\flow\module\Helper(); eq("a bc d ef g ", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>")); eq("abcdefg", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>", "")); eq("a-bc----d-ef--g-", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>", "-"));
<?php $t = new \org\rhaco\flow\module\Helper(); $str = "あいうえお12345かきくけこ"; eq("あいう", $t->trim_width($str, 7)); $t = new \org\rhaco\flow\module\Helper(); $str = "あいうえお12345かきくけこ"; eq("あいう...", $t->trim_width($str, 7, "...")); $t = new \org\rhaco\flow\module\Helper(); $str = "あいうえお12345かきくけこ"; eq("あいうえお123...", $t->trim_width($str, 13, "...")); $t = new \org\rhaco\flow\module\Helper(); $str = "あいうえお12345かきくけこ"; eq("あいうえお12345かきくけこ", $t->trim_width($str, 50, "...")); $t = new \org\rhaco\flow\module\Helper(); $str = "あいうえお12345かきくけこ"; eq("あいうえお12345かきくけこ", $t->trim_width($str, 30, "..."));
<?php $t = new \org\rhaco\flow\module\Helper(); $time = time(); eq(date("YmdHis", $time), $t->df("YmdHis", $time));
<?php $t = new \org\rhaco\flow\module\Helper(); eq("123,456,789", $t->number_format("123456789")); eq("123,456,789.020", $t->number_format("123456789.02", 3)); eq("123,456,789", $t->number_format("123456789.02"));