fitness-web/common/components/giro/GiroBase.php

43 lines
1.1 KiB
PHP

<?php
namespace common\components\giro;
use backend\models\GiroKotegForm;
class GiroBase {
public function mezoKitolt($input, $hossz, $pad_string = "") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitolt($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitoltJobb($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT);
}
public function szovegKitolt($input, $hossz, $pad_string = " ") {
$data = $input;
$data = GiroKotegForm::transliterate($data);
if ( strlen($data) > $hossz){
$data = substr($data, 0, $hossz );
}
$data = str_pad($data, $hossz, $pad_string, STR_PAD_RIGHT);
echo $data;
// echo strlen($data);
return $data;
}
public static function szovegOlvas($row,$start,$length, $padchar = " "){
return rtrim(substr($row, $start,$length),$padchar);
}
public static function szamOlvas($row,$start,$length, $padchar = "0"){
return ltrim(substr($row, $start,$length),$padchar);
}
public function rekordVege(){
return "\r\n";
}
}