StringCase is a process to convert string values to various case types such as "upper", "lower", "first-cap", "all-cap".
"upper" means all upper case strings. "lower" means all lower case string. "first-cap" means the first word with its first letter in upper case. "all-cap" means all words with their first letter in upper case.
Sample code
->pipe(new StringCase(array(
"all-cap" => "name",
// "upper" => "name, address",
// "lower" => "name, address",
// "first-cap" => "name, address",
// "all-cap" => "name, address"
)))
<?php
require_once "MyReport.php";
$report = new MyReport;
$report->run()->render();
<?php
//Step 1: Load KoolReport
require_once "../../../load.koolreport.php";
use \koolreport\processes\StringCase;
//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
protected function settings()
{
return array(
"dataSources"=>array(
"data"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"table",
"data"=>array(
array("name","income"),
array("John wick",50000),
array("Marry poppins",60000),
array("Peter pan",100000),
array("Donald duck",80000),
)
)
)
);
}
protected function setup()
{
//Prepare data
$this->src("data")
->pipe($this->dataStore("origin"));
//Pipe through process to get result
$this->src("data")
->pipe(new StringCase(array(
"all-cap" => "name",
// "upper" => "name, address",
// "lower" => "name, address",
// "first-cap" => "name, address",
// "all-cap" => "name, address"
)))
->pipe($this->dataStore("result"));
}
}
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\LineChart;
?>
<div class="report-content">
<div class="text-center">
<h1>StringCase Process</h1>
<p class="lead">Convert string values to upper case, lower case, first letter first world upper case , first letter all words upper case</p>
</div>
<?php
Table::create(array(
"dataSource"=>$this->dataStore("origin"),
"cssClass"=>array(
"table"=>"table-bordered table-striped table-hover"
)
));
?>
<i class="fa fa-arrow-down" style="font-size:24px;"></i>
<pre style="font-weight:bold"><code>
->pipe(new StringCase(array(
"all-cap" => "name",
// "upper" => "name, address",
// "lower" => "name, address",
// "first-cap" => "name, address",
// "all-cap" => "name, address"
)))
</code></pre>
<i class="fa fa-arrow-down" style="font-size:24px;"></i>
<div style="margin-top:20px;">
<?php
Table::create(array(
"dataSource"=>$this->dataStore("result"),
"cssClass"=>array(
"table"=>"table-bordered table-striped table-hover"
)
));
?>
</div>
</div>