예제 #1
0
<?php

$t = new \ebi\FlowHelper();
$str = "あいうえお12345かきくけこ";
eq("あいう", $t->trim_width($str, 7));
$t = new \ebi\FlowHelper();
$str = "あいうえお12345かきくけこ";
eq("あいう...", $t->trim_width($str, 7, "..."));
$t = new \ebi\FlowHelper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお123...", $t->trim_width($str, 13, "..."));
$t = new \ebi\FlowHelper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお12345かきくけこ", $t->trim_width($str, 50, "..."));
$t = new \ebi\FlowHelper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお12345かきくけこ", $t->trim_width($str, 30, "..."));
예제 #2
0
파일: df.php 프로젝트: tokushima/ebi
<?php

$t = new \ebi\FlowHelper();
$time = time();
eq(date("YmdHis", $time), $t->date_format("YmdHis", $time));
예제 #3
0
파일: one_liner.php 프로젝트: tokushima/ebi
<?php

$t = new \ebi\FlowHelper();
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>", "-"));
예제 #4
0
파일: build_url.php 프로젝트: tokushima/ebi
<?php

/**
 * \ebi\FlowHelper::build_url
 */
$t = new \ebi\FlowHelper();
eq('?A=1&B=2&C=3', $t->build_url(['A' => 1, 'B' => 2, 'C' => 3]));
eq('http://localhost/abc?A=1&B=2&C=3', $t->build_url('http://localhost/abc', ['A' => 1, 'B' => 2, 'C' => 3]));
eq('http://localhost/abc?hoge=1&A=1&B=2&C=3', $t->build_url('http://localhost/abc?hoge=1', ['A' => 1, 'B' => 2, 'C' => 3]));
eq('http://localhost/abc?hoge=1&xyz=ABC&A=1&B=2&C=3', $t->build_url('http://localhost/abc?hoge=1&xyz=', 'ABC', ['A' => 1, 'B' => 2, 'C' => 3]));
예제 #5
0
<?php

$t = new \ebi\FlowHelper();
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([], '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'));
예제 #6
0
<?php

$t = new \ebi\FlowHelper();
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"));
예제 #7
0
파일: zerofill.php 프로젝트: tokushima/ebi
<?php

$t = new \ebi\FlowHelper();
eq("00005", $t->zerofill(5, 5));
eq("5", $t->zerofill(5));