PHP Method stringy\ Stringy::substr Code Examples

PHP stringy\Stringy::substr - 3 examples found. These are the top rated real world PHP examples of method stringy\Stringy::substr extracted from open source projects. You can rate examples to help us improve the quality of examples
Frequently Used Methods

substr() public method

It differs from the mb_substr() function in that providing a $length of null will return the rest of the string, rather than an empty string.
public substr ( integer $start, integer $length = null ) : Stringy
$start integer Position of the first character to use
$length integer Maximum number of characters used
return Stringy Object with its $str being the substring
Example #1
0
 public function buildDetail(Stringy $linha)
 {
     $detail = new Detail();
     $banco = new Banco();
     $banco->setCod($linha->substr(1, 3));
     $detail->setLote($linha->substr(4, 4))->setRegistro($linha->substr(8, 1))->setNumRegistroLote($linha->substr(9, 5))->setSegmento($linha->substr(14, 1))->setTipoMovimento($linha->substr(15, 1))->setCodMovimento($linha->substr(16, 2));
     $banco->setAgencia($linha->substr(18, 5))->setDvAgencia($linha->substr(23, 1))->setConta($linha->substr(24, 12))->setDvConta($linha->substr(36, 1));
     $detail->setNossoNumero($linha->substr(38, 20))->setCarteira($linha->substr(58, 1))->setNumeroDocumento($linha->substr(59, 15))->setDataVencimento($linha->substr(74, 8))->setValorTitulo($linha->substr(82, 13));
     $banco->setCod($linha->substr(97, 3))->setAgencia($linha->substr(100, 5))->setDvAgencia($linha->substr(105, 1));
     $empresa = new Empresa();
     $empresa->addUso($linha->substr(106, 25));
     $detail->setCodMoeda($linha->substr(131, 2));
     $sacado = new Sacado();
     $sacado->setInscricao(new Inscricao($linha->substr(134, 15), $linha->substr(133, 1)))->setNome($linha->substr(149, 40));
     $detail->setNumeroContrato($linha->substr(189, 10))->setValorTarifa($linha->substr(199, 13))->addOcorrencia($linha->substr(214, 10))->addCnab($linha->substr(224, 17));
     $cedente = new Cedente();
     $cedente->setBanco($banco);
     $detail->setCedente($cedente)->setSacado($sacado);
     return $detail;
 }
Example #2
0
 public function buildDetail(Stringy $linha)
 {
     $detail = new Detail();
     $cedente = new Cedente();
     $banco = new Banco();
     $banco->setCod($linha->substr(1, 3));
     $detail->setLote($linha->substr(4, 4))->setRegistro($linha->substr(8, 1))->setNumRegistroLote($linha->substr(9, 5))->setSegmento($linha->substr(14, 1))->setTipoMovimento($linha->substr(15, 1))->setCodMovimento($linha->substr(16, 2))->setCodBarras($linha->substr(18, 44))->setDataVencimento($this->createDate($linha->substr(92, 8)))->setValorTitulo($linha->substr(100, 13))->setDesconto($linha->substr(115, 13))->setAcrescimos($linha->substr(130, 13))->setDataPagamento($this->createDate($linha->substr(145, 8)))->setValorPagamento($linha->substr(153, 13))->setQuantidadeMoeda($linha->substr(168, 10))->setReferenciaSacado($linha->substr(183, 20))->setNossoNumero($linha->substr(203, 20))->setCodMoeda($linha->substr(223, 2))->addCnab($linha->substr(225, 6))->addOcorrencia($linha->substr(231, 10));
     $cedente->setNome($linha->substr(62, 30))->setBanco($banco);
     $detail->setCedente($cedente);
     return $detail;
 }
 public function buildDetail(Stringy $linha)
 {
     $detail = new Detail();
     $banco = new Banco();
     $bancoSacado = new Banco();
     $sacado = new Sacado();
     $ocorrencia = new Ocorrencia();
     $dadosTitulo = new DadosTitulo();
     $cedente = new Cedente();
     $bancoSacado->setCod($linha->substr(1, 3));
     $sacado->setBanco($bancoSacado);
     $detail->setLote($linha->substr(4, 4))->setRegistro($linha->substr(8, 1))->setNumRegistroLote($linha->substr(9, 5))->setSegmento($linha->substr(14, 1))->addCnab($linha->substr(15, 1))->setCodMovimento($linha->substr(16, 2));
     //Dados do Titulo
     $dadosTitulo->setAcrescimos($this->convertToFloat($linha->substr(18, 15)))->setValorDesconto($this->convertToFloat($linha->substr(33, 15)))->setValorAbatimento($this->convertToFloat($linha->substr(48, 15)))->setValorIOF($this->convertToFloat($linha->substr(63, 15)))->setValorPago($this->convertToFloat($linha->substr(78, 15)))->setValorLiquido($this->convertToFloat($linha->substr(93, 15)));
     $detail->setDadosTitulo($dadosTitulo)->setOutrasDespesas($this->convertToFloat($linha->substr(108, 15)))->setOutrosCreditos($this->convertToFloat($linha->substr(123, 15)))->setDataOcorrencia($this->createDate($linha->substr(138, 8), "dmY"))->setDataCredito($this->createDate($linha->substr(146, 8), "dmY"));
     $ocorrencia->setCod($this->convertToInt($linha->substr(154, 4)))->setData($this->createDate($linha->substr(158, 8)))->setValor($this->convertToFloat($linha->substr(166, 15)))->setComplemento($linha->substr(181, 30));
     $banco->setCod($linha->substr(211, 3));
     $cedente->setBanco($banco);
     $detail->setNossoNumero($linha->substr(214, 20))->addCnab($linha->substr(234, 7));
     $detail->setCedente($cedente)->setSacado($sacado);
     return $detail;
 }