Advertisement
fruffl

Str CLass

Oct 9th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 42.94 KB | None | 0 0
  1. <?PHP
  2.     namespace ILLI\Core\Util;
  3.     use ILLI\Core\Std\DefaultStatic\__import_IDefaultStatic;
  4.     use ILLI\Core\Std\IDefaultStatic;
  5.     use ILLI\Core\Util\Arr;
  6.    
  7.     class Str implements IDefaultStatic
  8.     {
  9.         use __import_IDefaultStatic;
  10.        
  11.         #:php:
  12.         static function explode($__string, $__delimiter = __str::SPACE, $__limit = NULL)
  13.         {
  14.             return 0x02 >= func_num_args()
  15.                 ? explode($__delimiter, $__string)
  16.                 : explode($__delimiter, $__string, $__limit);
  17.         }
  18.        
  19.         static function f($__format, ...$__data)
  20.         {
  21.             $a = func_get_args();
  22.             return sprintf(...$a);
  23.         }
  24.        
  25.         static function join(array $__data, $__delimiter = __str::DEVOID)
  26.         {
  27.             return join($__delimiter, $__data);
  28.         }
  29.        
  30.         static function len($__string)
  31.         {
  32.             return strlen($__string);
  33.         }
  34.        
  35.         static function lc($__string)
  36.         {
  37.             return strtolower($__string);
  38.         }
  39.        
  40.         static function lcf($__string)
  41.         {
  42.             return ucfirst($__string);
  43.         }
  44.        
  45.         static function lcw($__string)
  46.         {
  47.             return ucwords($__string);
  48.         }
  49.        
  50.         static function pad($__string, $__length, $__delimiter, $__case)
  51.         {
  52.             return str_pad($__string, $__length, $__delimiter, $__case);
  53.         }
  54.        
  55.         static function pos($__string, $__needle, $__offset = 0x00)
  56.         {
  57.             return strpos($__string, $__needle, $__offset);
  58.         }
  59.        
  60.         static function pregMatch($__string, $__pattern, $__flag = 0x00, $__offset = 0x00)
  61.         {
  62.             if(0x02 >= func_num_args())
  63.                 return preg_match($__pattern, $__string);
  64.            
  65.             preg_match($__pattern, $__string, $matches, $__flag, $__offset);
  66.             return $matches;
  67.         }
  68.        
  69.         static function split($__string, $__length = 0x01)
  70.         {
  71.             return str_split($__string, $__length);
  72.         }
  73.        
  74.         static function sub($__string, $__start, $__length = NULL)
  75.         {
  76.             return 0x02 >= func_num_args()
  77.                 ? substr($__string, $__start)
  78.                 : substr($__string, $__start, $__length);
  79.         }
  80.        
  81.         static function tr($__string, $__from, $__to = NULL)
  82.         {
  83.             return 0x02 >= func_num_args()
  84.                 ? strtr($__string, $__from)
  85.                 : strtr($__string, $__from, $__to);
  86.         }
  87.        
  88.         static function uc($__string)
  89.         {
  90.             return strtoupper($__string);
  91.         }
  92.        
  93.         static function ucf($__string)
  94.         {
  95.             return ucfirst($__string);
  96.         }
  97.        
  98.         static function ucw($__string)
  99.         {
  100.             return ucwords($__string);
  101.         }
  102.        
  103.         static function repeat($__string, $__length)
  104.         {
  105.             return str_repeat($__string, $__length);
  106.         }
  107.        
  108.         static function replace($__string, $__search, $__replace)
  109.         {
  110.             return str_replace($__search, $__replace, $__string);
  111.         }
  112.         #::
  113.        
  114.         #:crypt:
  115.         static function encrypt($__string, $__secret)
  116.         {
  117.             return mcrypt_encrypt(MCRYPT_BLOWFISH, $__secret, utf8_encode($__string), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB), MCRYPT_RAND));
  118.         }
  119.        
  120.         static function decrypt($__string, $__secret)
  121.         {
  122.             return mcrypt_decrypt(MCRYPT_BLOWFISH, $__secret, $__string, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB), MCRYPT_RAND));
  123.         }
  124.         #::
  125.        
  126.         #:generator:
  127.         static function hash($__string, array $__options = [])
  128.         {
  129.             $__options +=
  130.             [
  131.                 'type'  => 'sha512',
  132.                 'salt'  => FALSE,
  133.                 'key'   => FALSE,
  134.                 'raw'   => FALSE
  135.             ];
  136.            
  137.             if(TRUE === $__options['salt'])
  138.                 $__string = $__options['salt'].$__string;
  139.            
  140.             return TRUE === $__options['key']
  141.                 ? hash_hmac($__options['type'], $__string, $__options['key'], $__options['raw'])
  142.                 : hash($__options['type'], $__string, $__options['raw']);
  143.         }
  144.        
  145.         static function rand($__bytes, array $__options = [])
  146.         {
  147.             $__options += ['encode' => NULL];
  148.        
  149.             static $__fn_STATIC_rand;
  150.            
  151.             #:rand:
  152.             isset($__fn_STATIC_rand) ?: $__fn_STATIC_rand = function($__bytes)
  153.             {
  154.                 $r = __str::DEVOID;
  155.                
  156.                 for($i = 0x00; $i < $__bytes; $i++)
  157.                     $r .= chr(mt_rand(0x00, 0xFF));
  158.                
  159.                 return $r;
  160.             };
  161.             #::
  162.            
  163.             $r = $__fn_STATIC_rand($__bytes);
  164.            
  165.             return ($__options['encode'] === static::ENCODE_BASE_64)
  166.                 ? static::tr(rtrim(base64_encode($r), __str::EQ), __str::PLUS, __str::DOT)
  167.                 : $r;
  168.         }
  169.         #::
  170.        
  171.         #:format:
  172.         static function bom($__string = NULL)
  173.         {
  174.             return chr(255).chr(254).$__string;
  175.         }
  176.        
  177.         static function compare($__left, $__right)
  178.         {
  179.             $r = TRUE;
  180.        
  181.             if(($l = static::len($__left)) !== static::len($__right))
  182.                 return FALSE;
  183.        
  184.             for($i = 0x00; $i < $l; $i++)
  185.                 $r = $r && ($__left[$i] === $__right[$i]);
  186.            
  187.             return $r;
  188.         }
  189.        
  190.         static function hexdump($__string, array $__options = [])
  191.         {
  192.             $__options +=
  193.             [
  194.                 'width'     => 0x10,
  195.                 'eol'       => __str::EOL,
  196.                 'space'     => __str::SPACE,
  197.                 'raw'       => FALSE,
  198.                 'invisible' => __str::INVISIBLE,
  199.                 'pattern'   => '{:x} : {:line} : {:part}',
  200.                 'from'      => 0x20,
  201.                 'to'        => 0x7E
  202.             ];
  203.            
  204.             static $__fn_STATIC_from, $__fn_STATIC_to, $__fn_STATIC_walk;
  205.            
  206.             #:walk:
  207.             isset($__fn_STATIC_walk) ?: $__fn_STATIC_walk = function($__start, $__stop, callable $__Handler, array $__options = [])
  208.             {
  209.                 $r = [];
  210.                 for($i = $__start; $i <= $__stop; $i++)
  211.                     $r[] = $__Handler($i, $__options);
  212.                
  213.                 return static::join($r);
  214.             };
  215.             #::
  216.            
  217.             #:from:
  218.             isset($__fn_STATIC_from) ?: $__fn_STATIC_from = $__fn_STATIC_walk
  219.             (
  220.                 0x00, 0xFF,
  221.                 function($__i, array $__options = []){ return chr($__i); },
  222.                 $__options
  223.             );
  224.             #::
  225.            
  226.             #:to:
  227.             isset($__fn_STATIC_to) ?: $__fn_STATIC_to = $__fn_STATIC_walk
  228.             (
  229.                 0x00, 0xFF,
  230.                 function($__i, array $__options = []){ return $__i >= $__options['from'] && $__i <= $__options['to'] ? chr($__i) : $__options['invisible']; },
  231.                 $__options
  232.             );
  233.             #::
  234.            
  235.             $c = static::split(static::tr($__string, $__fn_STATIC_from, $__fn_STATIC_to), $__options['width']);
  236.             $p = static::split($__string, $__options['width']);
  237.             $h = static::split(bin2hex($__string), $__options['width'] * 0x02);
  238.             $o = 0;
  239.             $r = [];
  240.            
  241.             foreach($h as $i => $l)
  242.             {
  243.                 $s = sizeOf($l = static::split($l, 0x02)) === $__options['width'] ?: $l += array_fill($s, $__options['width'] - $s, __str::LITSPACE);
  244.                
  245.                 $r[] = TRUE === $__options['raw']
  246.                     ? ['offset' => $o, 'line' => $l, 'part' => $c[$i], 'orig' => $p[$i]]
  247.                     : static::insert($__options['pattern'], ['x' => sprintf('%8X', $o), 'line' => static::join($l, $__options['space']), 'part' => $c[$i]]);
  248.                
  249.                 $o  += $__options['width'];
  250.             }
  251.            
  252.             if(TRUE === $__options['raw'])
  253.                 return $r;
  254.            
  255.             return FALSE === $__options['eol']
  256.                 ? $r
  257.                 : static::join($r, $__options['eol']);
  258.         }
  259.        
  260.         static function sequence(array $__data, array $__options = [])
  261.         {
  262.             return static::__sequence($__data, $__options);
  263.         }
  264.        
  265.         protected static function __sequence($__data, $__options, $__level = 0x01)
  266.         {
  267.             if(FALSE === is_array($__data))
  268.                 return $__data;
  269.            
  270.             if([] === $__data)
  271.                 return '[]';
  272.            
  273.             $__options +=
  274.             [
  275.                 'eol'       => __str::EOL,
  276.                 'indent'    => 0x00,
  277.                 'head'      => 0x18,
  278.                 'padding'   => 0x04,
  279.                 'text'      => 0x34,
  280.             ];
  281.            
  282.             $r = [];
  283.             $i = static::repeat('.', $__options['indent']);
  284.            
  285.             if($__level === 0x01)
  286.             {
  287.                 foreach($__data as $k => $v)
  288.                 {
  289.                     $_k = static::explodeEoL(wordwrap($k, $__options['head'], __str::EOL));
  290.                     $_v = is_array($v)
  291.                         ? static::explodeEoL(static::__sequence($v, $__options, $__level + 0x01))
  292.                         : static::explodeEoL(wordwrap($v, $__options['text'], __str::EOL));
  293.                    
  294.                     $a = [];
  295.                    
  296.                     foreach(array_keys(count($_k) > count($_v) ? $_k : $_v) as $l)
  297.                     {
  298.                         $a[] = sprintf(sprintf('%%%ds', $__options['head']), isset($_k[$l]) ? trim($_k[$l]) : '');
  299.                         !isset($_v[$l]) ?: $a[] = '    ';
  300.                         $a[] = trim(sprintf(sprintf('%%-%ds', $__options['text']), isset($_v[$l]) ? trim($_v[$l]) : ''));
  301.                         $a[] = $__options['eol'].$i;
  302.                     }
  303.                    
  304.                     $r[] = $i.join('', $a);
  305.                 }
  306.             }
  307.             else
  308.             {
  309.                 foreach($__data as $k => $v)
  310.                 {
  311.                     $_k = static::explodeEoL(wordwrap($k, $__options['text'], __str::EOL));
  312.                     $_v = is_array($v)
  313.                         ? static::explodeEoL(static::__sequence($v, $__options, $__level + 0x01))
  314.                         : static::explodeEoL(wordwrap($v, $__options['text'], __str::EOL));
  315.                    
  316.                     $a = [];
  317.                    
  318.                     foreach($_k as $l)
  319.                     {
  320.                         if(is_integer($k))
  321.                             continue;
  322.                        
  323.                         $a[] = $l === '' ? '' : sprintf(sprintf('%%-%ds', $__options['text']), $l);
  324.                         $a[] = static::repeat('-', $__options['text']);
  325.                     }
  326.                    
  327.                     foreach($_v as $l)
  328.                     {
  329.                         if($l === '')
  330.                             continue;
  331.                        
  332.                         $a[] = sprintf(sprintf('%%-%ds', $__options['text']), $l);
  333.                         is_integer($k) ?: $a[] = $__options['eol'];
  334.                        
  335.                     }
  336.                    
  337.                     $r[] = join($__options['eol'], $a);
  338.                 }
  339.             }
  340.            
  341.             return join($__options['eol'], $r);
  342.         }
  343.         #::
  344.        
  345.         #:tests:
  346.         static function isUtf8($__mixed)
  347.         {
  348.             return TRUE === is_string($__mixed) && 0x01 === preg_match('/^.*$/us', $__mixed);
  349.         }
  350.         #::
  351.        
  352.         #:aggregate:
  353.         static function concat($__stringN)
  354.         {
  355.             return static::join(func_get_args(), __str::DEVOID);
  356.         }
  357.        
  358.         static function lcfi($__string)
  359.         {
  360.             return static::lcf(static::uc($__string));
  361.         }
  362.        
  363.         static function lcwi($__string)
  364.         {
  365.             return static::lcw(static::uc($__string));
  366.         }
  367.        
  368.         static function match($__string, $__pattern, array $__options = [])
  369.         {
  370.             $__options += [
  371.                 'matches'   => FALSE,
  372.                 'mod'       => '',
  373.                 'flag'      => 0,
  374.                 'offset'    => 0,
  375.                 'escapeSlash'   => TRUE,
  376.                 'format'    => FALSE
  377.             ];
  378.            
  379.             if(FALSE !== $__options['format'])
  380.                 $__pattern = static::insert($__pattern, $__options['format']);
  381.            
  382.             $__pattern = static::concat
  383.             (
  384.                 __str::SLASH,
  385.                 TRUE === $__options['escapeSlash']
  386.                     ? static::replace($__pattern, __str::SLASH, __str::ESLASH)
  387.                     : $__pattern,
  388.                 __str::SLASH,
  389.                 $__options['mod']
  390.             );
  391.            
  392.             return FALSE === $__options['matches']
  393.                 ? (bool) static::pregMatch($__pattern, $__string)
  394.                 : static::pregMatch($__pattern, $__string, $__options['flag'], $__options['offset']);
  395.         }
  396.        
  397.         static function ucfi($__string)
  398.         {
  399.             return static::ucf(static::lc($__string));
  400.         }
  401.        
  402.         static function ucwi($__string)
  403.         {
  404.             return static::ucw(static::lc($__string));
  405.         }
  406.         #::
  407.        
  408.         #:chr:
  409.         static function insert($__string, $__insert, $__index, $__concat = TRUE, $__length = 0x01)
  410.         {
  411.             $r = static::split($__string, $__length);
  412.             array_splice($r, $__index, 0x00, $__insert);
  413.             return TRUE === $__concat ? static::join($r) : $r;
  414.         }
  415.        
  416.         static function merge($__string, array $__data, $__concat = TRUE, $__length = 0x01)
  417.         {
  418.             $r = static::split($__string, $__length);
  419.             foreach($__data as $k => $v)
  420.                 $r[$k] = $v;
  421.            
  422.             return TRUE === $__concat ? static::join($r) : $r;
  423.         }
  424.        
  425.         static function range($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  426.         {
  427.             $r = static::split($__string, $__length);
  428.            
  429.             return TRUE === $__concat
  430.                 ? [
  431.                     0x00 => static::join(array_slice($r, 0x00, $__index)),
  432.                     0x01 => static::join(array_slice($r, $__index, $__count)),
  433.                     0x02 => static::join(array_slice($r, $__index + $__count))
  434.                 ]
  435.                 : [
  436.                     0x00 => array_slice($r, 0x00, $__index),
  437.                     0x01 => array_slice($r, $__index, $__count),
  438.                     0x02 => array_slice($r, $__index + $__count)
  439.                 ];
  440.         }
  441.        
  442.         static function remove($__string, $__index, $__concat = TRUE, $__length = 0x01)
  443.         {
  444.             $r = static::split($__string, $__length);
  445.             unset($r[$__index]);
  446.             return TRUE === $__concat ? static::join($r) : $r;
  447.         }
  448.        
  449.         static function removeRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  450.         {
  451.             $r = static::range($__string, $__index, $__count, TRUE, $__length);
  452.             unset($r[0x01]);
  453.             return TRUE === $__concat ? static::join($r) : $r;
  454.         }
  455.        
  456.         static function reverse($__string, $__concat = TRUE, $__length = 0x01)
  457.         {
  458.             $r = array_reverse(static::split($__string, $__length));
  459.             return TRUE === $__concat ? static::join($r) : $r;
  460.         }
  461.        
  462.         static function reverseRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  463.         {
  464.             $r = static::range($__string, $__index, $__count, FALSE, $__length);
  465.            
  466.             $r[0x01] = array_reverse($r[0x01]);
  467.            
  468.             $r[0x00] = static::join($r[0x00]);
  469.             $r[0x01] = static::join($r[0x01]);
  470.             $r[0x02] = static::join($r[0x02]);
  471.            
  472.             return TRUE === $__concat ? static::join($r) : $r;
  473.         }
  474.         #::
  475.        
  476.         #:sequence:
  477.         static function insertAt($__string, $__delimiter, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  478.         {
  479.             $r = 0x05 >= func_num_args()
  480.                 ? static::explode($__string, $__delimiter)
  481.                 : static::explode($__string, $__delimiter, $__limit);
  482.            
  483.             array_splice($r, $__index, 0x00, $__insert);
  484.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  485.         }
  486.        
  487.         static function mergeAt($__string, $__delimiter, array $__data, $__concat = TRUE, $__limit = NULL)
  488.         {
  489.             $r = 0x04 >= func_num_args()
  490.                 ? static::explode($__string, $__delimiter)
  491.                 : static::explode($__string, $__delimiter, $__limit);
  492.            
  493.             foreach($__data as $k => $v)
  494.                 $r[$k] = $v;
  495.            
  496.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  497.         }
  498.        
  499.         static function rangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  500.         {
  501.             $r = 0x05 >= func_num_args()
  502.                 ? static::explode($__string, $__delimiter)
  503.                 : static::explode($__string, $__delimiter, $__limit);
  504.            
  505.             return TRUE === $__concat
  506.                 ? [
  507.                     0x00 => static::join(array_slice($r, 0x00, $__index), $__delimiter),
  508.                     0x01 => static::join(array_slice($r, $__index, $__count), $__delimiter),
  509.                     0x02 => static::join(array_slice($r, $__index + $__count), $__delimiter)
  510.                 ]
  511.                 : [
  512.                     0x00 => array_slice($r, 0x00, $__index),
  513.                     0x01 => array_slice($r, $__index, $__count),
  514.                     0x02 => array_slice($r, $__index + $__count)
  515.                 ];
  516.         }
  517.        
  518.         static function removeAt($__string, $__delimiter, $__index, $__concat = TRUE, $__limit = NULL)
  519.         {
  520.             $r = 0x03 >= func_num_args()
  521.                 ? static::explode($__string, $__delimiter)
  522.                 : static::explode($__string, $__delimiter, $__limit);
  523.            
  524.             unset($r[$__index]);
  525.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  526.         }
  527.        
  528.         static function removeRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  529.         {
  530.             $r = 0x05 >= func_num_args()
  531.                 ? static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE)
  532.                 : static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE, $__limit);
  533.            
  534.             unset($r[0x01]);
  535.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  536.         }
  537.        
  538.         static function reverseAt($__string, $__delimiter, $__concat = TRUE, $__limit = NULL)
  539.         {
  540.             $r = 0x03 >= func_num_args()
  541.                 ? static::explode($__string, $__delimiter)
  542.                 : static::explode($__string, $__delimiter, $__limit);
  543.            
  544.             $r = array_reverse($r);
  545.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  546.         }
  547.        
  548.         static function reverseRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  549.         {
  550.             $r = 0x05 >= func_num_args()
  551.                 ? static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE)
  552.                 : static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE, $__limit);
  553.            
  554.             $r[0x01] = array_reverse($r[0x01]);
  555.            
  556.             $r[0x00] = static::join($r[0x00], $__delimiter);
  557.             $r[0x01] = static::join($r[0x01], $__delimiter);
  558.             $r[0x02] = static::join($r[0x02], $__delimiter);
  559.            
  560.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  561.         }
  562.         #::
  563.        
  564.         #:insertAt:
  565.         static function insertAtDir($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  566.         {
  567.             return 0x04 >= func_num_args()
  568.                 ? static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat)
  569.                 : static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat, $__limit);
  570.         }
  571.        
  572.         static function insertAtDot($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  573.         {
  574.             return 0x04 >= func_num_args()
  575.                 ? static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat)
  576.                 : static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat, $__limit);
  577.         }
  578.        
  579.         static function insertAtEoL($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  580.         {
  581.             return 0x04 >= func_num_args()
  582.                 ? static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat)
  583.                 : static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat, $__limit);
  584.         }
  585.        
  586.         static function insertAtMinus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  587.         {
  588.             return 0x04 >= func_num_args()
  589.                 ? static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat)
  590.                 : static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat, $__limit);
  591.         }
  592.        
  593.         static function insertAtPath($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  594.         {
  595.             return 0x04 >= func_num_args()
  596.                 ? static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat)
  597.                 : static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat, $__limit);
  598.         }
  599.        
  600.         static function insertAtPlus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  601.         {
  602.             return 0x04 >= func_num_args()
  603.                 ? static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat)
  604.                 : static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat, $__limit);
  605.         }
  606.        
  607.         static function insertAtSlash($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  608.         {
  609.             return 0x04 >= func_num_args()
  610.                 ? static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat)
  611.                 : static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat, $__limit);
  612.         }
  613.        
  614.         static function insertAtSpace($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  615.         {
  616.             return 0x04 >= func_num_args()
  617.                 ? static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat)
  618.                 : static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat, $__limit);
  619.         }
  620.        
  621.         static function insertAtUnderscore($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  622.         {
  623.             return 0x04 >= func_num_args()
  624.                 ? static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat)
  625.                 : static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat, $__limit);
  626.         }
  627.         #::
  628.        
  629.         #:rangeAt:
  630.         static function rangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  631.         {
  632.             return 0x04 >= func_num_args()
  633.                 ? static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  634.                 : static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  635.         }
  636.        
  637.         static function rangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  638.         {
  639.             return 0x04 >= func_num_args()
  640.                 ? static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  641.                 : static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  642.         }
  643.        
  644.         static function rangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  645.         {
  646.             return 0x04 >= func_num_args()
  647.                 ? static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  648.                 : static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  649.         }
  650.        
  651.         static function rangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  652.         {
  653.             return 0x04 >= func_num_args()
  654.                 ? static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  655.                 : static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  656.         }
  657.        
  658.         static function rangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  659.         {
  660.             return 0x04 >= func_num_args()
  661.                 ? static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  662.                 : static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  663.         }
  664.        
  665.         static function rangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  666.         {
  667.             return 0x04 >= func_num_args()
  668.                 ? static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  669.                 : static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  670.         }
  671.        
  672.         static function rangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  673.         {
  674.             return 0x04 >= func_num_args()
  675.                 ? static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  676.                 : static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  677.         }
  678.        
  679.         static function rangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  680.         {
  681.             return 0x04 >= func_num_args()
  682.                 ? static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  683.                 : static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  684.         }
  685.        
  686.         static function rangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  687.         {
  688.             return 0x04 >= func_num_args()
  689.                 ? static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  690.                 : static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  691.         }
  692.         #::
  693.        
  694.         #:mergeAt:
  695.         static function mergeAtDir($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  696.         {
  697.             return 0x03 >= func_num_args()
  698.                 ? static::mergeAt($__string, __str::DIR, $__data, $__concat)
  699.                 : static::mergeAt($__string, __str::DIR, $__data, $__concat, $__limit);
  700.         }
  701.        
  702.         static function mergeAtDot($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  703.         {
  704.             return 0x03 >= func_num_args()
  705.                 ? static::mergeAt($__string, __str::DOT, $__data, $__concat)
  706.                 : static::mergeAt($__string, __str::DOT, $__data, $__concat, $__limit);
  707.         }
  708.        
  709.         static function mergeAtEoL($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  710.         {
  711.             return 0x03 >= func_num_args()
  712.                 ? static::mergeAt($__string, __str::EOL, $__data, $__concat)
  713.                 : static::mergeAt($__string, __str::EOL, $__data, $__concat, $__limit);
  714.         }
  715.        
  716.         static function mergeAtMinus($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  717.         {
  718.             return 0x03 >= func_num_args()
  719.                 ? static::mergeAt($__string, __str::MINUS, $__data, $__concat)
  720.                 : static::mergeAt($__string, __str::MINUS, $__data, $__concat, $__limit);
  721.         }
  722.        
  723.         static function mergeAtPath($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  724.         {
  725.             return 0x03 >= func_num_args()
  726.                 ? static::mergeAt($__string, __str::PATH, $__data, $__concat)
  727.                 : static::mergeAt($__string, __str::PATH, $__data, $__concat, $__limit);
  728.         }
  729.        
  730.         static function mergeAtPlus($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  731.         {
  732.             return 0x03 >= func_num_args()
  733.                 ? static::mergeAt($__string, __str::PLUS, $__data, $__concat)
  734.                 : static::mergeAt($__string, __str::PLUS, $__data, $__concat, $__limit);
  735.         }
  736.        
  737.         static function mergeAtSlash($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  738.         {
  739.             return 0x03 >= func_num_args()
  740.                 ? static::mergeAt($__string, __str::SLASH, $__data, $__concat)
  741.                 : static::mergeAt($__string, __str::SLASH, $__data, $__concat, $__limit);
  742.         }
  743.        
  744.         static function mergeAtSpace($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  745.         {
  746.             return 0x03 >= func_num_args()
  747.                 ? static::mergeAt($__string, __str::SPACE, $__data, $__concat)
  748.                 : static::mergeAt($__string, __str::SPACE, $__data, $__concat, $__limit);
  749.         }
  750.        
  751.         static function mergeAtUnderscore($__string, array $__data, $__concat = TRUE, $__limit = NULL)
  752.         {
  753.             return 0x03 >= func_num_args()
  754.                 ? static::mergeAt($__string, __str::UNDERSCORE, $__data, $__concat)
  755.                 : static::mergeAt($__string, __str::UNDERSCORE, $__data, $__concat, $__limit);
  756.         }
  757.         #::
  758.        
  759.         #:removeAt:
  760.         static function removeAtDir($__string, $__index, $__concat = TRUE, $__limit = NULL)
  761.         {
  762.             return 0x03 >= func_num_args()
  763.                 ? static::removeAt($__string, __str::DIR, $__index, $__concat)
  764.                 : static::removeAt($__string, __str::DIR, $__index, $__concat, $__limit);
  765.         }
  766.        
  767.         static function removeAtDot($__string, $__index, $__concat = TRUE, $__limit = NULL)
  768.         {
  769.             return 0x03 >= func_num_args()
  770.                 ? static::removeAt($__string, __str::DOT, $__index, $__concat)
  771.                 : static::removeAt($__string, __str::DOT, $__index, $__concat, $__limit);
  772.         }
  773.        
  774.         static function removeAtEoL($__string, $__index, $__concat = TRUE, $__limit = NULL)
  775.         {
  776.             return 0x03 >= func_num_args()
  777.                 ? static::removeAt($__string, __str::EOL, $__index, $__concat)
  778.                 : static::removeAt($__string, __str::EOL, $__index, $__concat, $__limit);
  779.         }
  780.        
  781.         static function removeAtMinus($__string, $__index, $__concat = TRUE, $__limit = NULL)
  782.         {
  783.             return 0x03 >= func_num_args()
  784.                 ? static::removeAt($__string, __str::MINUS, $__index, $__concat)
  785.                 : static::removeAt($__string, __str::MINUS, $__index, $__concat, $__limit);
  786.         }
  787.        
  788.         static function removeAtPath($__string, $__index, $__concat = TRUE, $__limit = NULL)
  789.         {
  790.             return 0x03 >= func_num_args()
  791.                 ? static::removeAt($__string, __str::PATH, $__index, $__concat)
  792.                 : static::removeAt($__string, __str::PATH, $__index, $__concat, $__limit);
  793.         }
  794.        
  795.         static function removeAtPlus($__string, $__index, $__concat = TRUE, $__limit = NULL)
  796.         {
  797.             return 0x03 >= func_num_args()
  798.                 ? static::removeAt($__string, __str::PLUS, $__index, $__concat)
  799.                 : static::removeAt($__string, __str::PLUS, $__index, $__concat, $__limit);
  800.         }
  801.        
  802.         static function removeAtSlash($__string, $__index, $__concat = TRUE, $__limit = NULL)
  803.         {
  804.             return 0x03 >= func_num_args()
  805.                 ? static::removeAt($__string, __str::SLASH, $__index, $__concat)
  806.                 : static::removeAt($__string, __str::SLASH, $__index, $__concat, $__limit);
  807.         }
  808.        
  809.         static function removeAtSpace($__string, $__index, $__concat = TRUE, $__limit = NULL)
  810.         {
  811.             return 0x03 >= func_num_args()
  812.                 ? static::removeAt($__string, __str::SPACE, $__index, $__concat)
  813.                 : static::removeAt($__string, __str::SPACE, $__index, $__concat, $__limit);
  814.         }
  815.        
  816.         static function removeAtUnderscore($__string, $__index, $__concat = TRUE, $__limit = NULL)
  817.         {
  818.             return 0x03 >= func_num_args()
  819.                 ? static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat)
  820.                 : static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat, $__limit);
  821.         }
  822.         #::
  823.        
  824.         #:removeRangeAt:
  825.         static function removeRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  826.         {
  827.             return 0x04 >= func_num_args()
  828.                 ? static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  829.                 : static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  830.         }
  831.        
  832.         static function removeRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  833.         {
  834.             return 0x04 >= func_num_args()
  835.                 ? static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  836.                 : static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  837.         }
  838.        
  839.         static function removeRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  840.         {
  841.             return 0x04 >= func_num_args()
  842.                 ? static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  843.                 : static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  844.         }
  845.        
  846.         static function removeRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  847.         {
  848.             return 0x04 >= func_num_args()
  849.                 ? static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  850.                 : static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  851.         }
  852.        
  853.         static function removeRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  854.         {
  855.             return 0x04 >= func_num_args()
  856.                 ? static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  857.                 : static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  858.         }
  859.        
  860.         static function removeRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  861.         {
  862.             return 0x04 >= func_num_args()
  863.                 ? static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  864.                 : static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  865.         }
  866.        
  867.         static function removeRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  868.         {
  869.             return 0x04 >= func_num_args()
  870.                 ? static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  871.                 : static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  872.         }
  873.        
  874.         static function removeRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  875.         {
  876.             return 0x04 >= func_num_args()
  877.                 ? static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  878.                 : static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  879.         }
  880.        
  881.         static function removeRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  882.         {
  883.             return 0x04 >= func_num_args()
  884.                 ? static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  885.                 : static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  886.         }
  887.         #::
  888.        
  889.         #:reverseAt:
  890.         static function reverseAtDir($__string, $__concat = TRUE, $__limit = NULL)
  891.         {
  892.             return 0x02 >= func_num_args()
  893.                 ? static::reverseAt($__string, __str::DIR, $__concat)
  894.                 : static::reverseAt($__string, __str::DIR, $__concat, $__limit);
  895.         }
  896.        
  897.         static function reverseAtDot($__string, $__concat = TRUE, $__limit = NULL)
  898.         {
  899.             return 0x02 >= func_num_args()
  900.                 ? static::reverseAt($__string, __str::DOT, $__concat)
  901.                 : static::reverseAt($__string, __str::DOT, $__concat, $__limit);
  902.         }
  903.        
  904.         static function reverseAtEoL($__string, $__concat = TRUE, $__limit = NULL)
  905.         {
  906.             return 0x02 >= func_num_args()
  907.                 ? static::reverseAt($__string, __str::EOL, $__concat)
  908.                 : static::reverseAt($__string, __str::EOL, $__concat, $__limit);
  909.         }
  910.        
  911.         static function reverseAtMinus($__string, $__concat = TRUE, $__limit = NULL)
  912.         {
  913.             return 0x02 >= func_num_args()
  914.                 ? static::reverseAt($__string, __str::MINUS, $__concat)
  915.                 : static::reverseAt($__string, __str::MINUS, $__concat, $__limit);
  916.         }
  917.        
  918.         static function reverseAtPath($__string, $__concat = TRUE, $__limit = NULL)
  919.         {
  920.             return 0x02 >= func_num_args()
  921.                 ? static::reverseAt($__string, __str::PATH, $__concat)
  922.                 : static::reverseAt($__string, __str::PATH, $__concat, $__limit);
  923.         }
  924.        
  925.         static function reverseAtPlus($__string, $__concat = TRUE, $__limit = NULL)
  926.         {
  927.             return 0x02 >= func_num_args()
  928.                 ? static::reverseAt($__string, __str::PLUS, $__concat)
  929.                 : static::reverseAt($__string, __str::PLUS, $__concat, $__limit);
  930.         }
  931.        
  932.         static function reverseAtSlash($__string, $__concat = TRUE, $__limit = NULL)
  933.         {
  934.             return 0x02 >= func_num_args()
  935.                 ? static::reverseAt($__string, __str::SLASH, $__concat)
  936.                 : static::reverseAt($__string, __str::SLASH, $__concat, $__limit);
  937.         }
  938.        
  939.         static function reverseAtSpace($__string, $__concat = TRUE, $__limit = NULL)
  940.         {
  941.             return 0x02 >= func_num_args()
  942.                 ? static::reverseAt($__string, __str::SPACE, $__concat)
  943.                 : static::reverseAt($__string, __str::SPACE, $__concat, $__limit);
  944.         }
  945.        
  946.         static function reverseAtUnderscore($__string, $__concat = TRUE, $__limit = NULL)
  947.         {
  948.             return 0x02 >= func_num_args()
  949.                 ? static::reverseAt($__string, __str::UNDERSCORE, $__concat)
  950.                 : static::reverseAt($__string, __str::UNDERSCORE, $__concat, $__limit);
  951.         }
  952.         #::
  953.        
  954.         #:reverseRangeAt:
  955.         static function reverseRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  956.         {
  957.             return 0x04 >= func_num_args()
  958.                 ? static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  959.                 : static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  960.         }
  961.        
  962.         static function reverseRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  963.         {
  964.             return 0x04 >= func_num_args()
  965.                 ? static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  966.                 : static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  967.         }
  968.        
  969.         static function reverseRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  970.         {
  971.             return 0x04 >= func_num_args()
  972.                 ? static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  973.                 : static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  974.         }
  975.        
  976.         static function reverseRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  977.         {
  978.             return 0x04 >= func_num_args()
  979.                 ? static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  980.                 : static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  981.         }
  982.        
  983.         static function reverseRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  984.         {
  985.             return 0x04 >= func_num_args()
  986.                 ? static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  987.                 : static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  988.         }
  989.        
  990.         static function reverseRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  991.         {
  992.             return 0x04 >= func_num_args()
  993.                 ? static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  994.                 : static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  995.         }
  996.        
  997.         static function reverseRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  998.         {
  999.             return 0x04 >= func_num_args()
  1000.                 ? static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  1001.                 : static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  1002.         }
  1003.        
  1004.         static function reverseRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  1005.         {
  1006.             return 0x04 >= func_num_args()
  1007.                 ? static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  1008.                 : static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  1009.         }
  1010.        
  1011.         static function reverseRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  1012.         {
  1013.             return 0x04 >= func_num_args()
  1014.                 ? static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  1015.                 : static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  1016.         }
  1017.         #::
  1018.        
  1019.         #:explode:
  1020.         static function explodeDir($__string, $__limit = NULL)
  1021.         {
  1022.             return 0x01 >= func_num_args()
  1023.                 ? static::explode($__string, __str::DIR)
  1024.                 : static::explode($__string, __str::DIR, $__limit);
  1025.         }
  1026.        
  1027.         static function explodeDot($__string, $__limit = NULL)
  1028.         {
  1029.             return 0x01 >= func_num_args()
  1030.                 ? static::explode($__string, __str::DOT)
  1031.                 : static::explode($__string, __str::DOT, $__limit);
  1032.         }
  1033.        
  1034.         static function explodeEoL($__string, $__limit = NULL)
  1035.         {
  1036.             return 0x01 >= func_num_args()
  1037.                 ? static::explode($__string, __str::EOL)
  1038.                 : static::explode($__string, __str::EOL, $__limit);
  1039.         }
  1040.        
  1041.         static function explodeMinus($__string, $__limit = NULL)
  1042.         {
  1043.             return 0x01 >= func_num_args()
  1044.                 ? static::explode($__string, __str::MINUS)
  1045.                 : static::explode($__string, __str::MINUS, $__limit);
  1046.         }
  1047.        
  1048.         static function explodePath($__string, $__limit = NULL)
  1049.         {
  1050.             return 0x01 >= func_num_args()
  1051.                 ? static::explode($__string, __str::PATH)
  1052.                 : static::explode($__string, __str::PATH, $__limit);
  1053.         }
  1054.        
  1055.         static function explodePlus($__string, $__limit = NULL)
  1056.         {
  1057.             return 0x01 >= func_num_args()
  1058.                 ? static::explode($__string, __str::PLUS)
  1059.                 : static::explode($__string, __str::PLUS, $__limit);
  1060.         }
  1061.        
  1062.         static function explodeSlash($__string, $__limit = NULL)
  1063.         {
  1064.             return 0x01 >= func_num_args()
  1065.                 ? static::explode($__string, __str::SLASH)
  1066.                 : static::explode($__string, __str::SLASH, $__limit);
  1067.         }
  1068.        
  1069.         static function explodeSpace($__string, $__limit = NULL)
  1070.         {
  1071.             return 0x01 >= func_num_args()
  1072.                 ? static::explode($__string, __str::SPACE)
  1073.                 : static::explode($__string, __str::SPACE, $__limit);
  1074.         }
  1075.        
  1076.         static function explodeUnderscore($__string, $__limit = NULL)
  1077.         {
  1078.             return 0x01 >= func_num_args()
  1079.                 ? static::explode($__string, __str::UNDERSCORE)
  1080.                 : static::explode($__string, __str::UNDERSCORE, $__limit);
  1081.         }
  1082.         #::
  1083.        
  1084.         #:join:
  1085.         static function joinDir(array $__data)
  1086.         {
  1087.             return static::join($__data, __str::DIR);
  1088.         }
  1089.        
  1090.         static function joinDot(array $__data)
  1091.         {
  1092.             return static::join($__data, __str::DOT);
  1093.         }
  1094.        
  1095.         static function joinEoL(array $__data)
  1096.         {
  1097.             return static::join($__data, __str::EOL);
  1098.         }
  1099.        
  1100.         static function joinMinus(array $__data)
  1101.         {
  1102.             return static::join($__data, __str::MINUS);
  1103.         }
  1104.        
  1105.         static function joinPath(array $__data)
  1106.         {
  1107.             return static::join($__data, __str::PATH);
  1108.         }
  1109.        
  1110.         static function joinPlus(array $__data)
  1111.         {
  1112.             return static::join($__data, __str::PLUS);
  1113.         }
  1114.        
  1115.         static function joinSlash(array $__data)
  1116.         {
  1117.             return static::join($__data, __str::SLASH);
  1118.         }
  1119.        
  1120.         static function joinSpace(array $__data)
  1121.         {
  1122.             return static::join($__data, __str::SPACE);
  1123.         }
  1124.        
  1125.         static function joinUnderscore(array $__data)
  1126.         {
  1127.             return static::join($__data, __str::UNDERSCORE);
  1128.         }
  1129.        
  1130.         static function joinWords(array $__data, $__beforeLast = NULL)
  1131.         {
  1132.             if(NULL === $__beforeLast || 0x01 >= count($__data))
  1133.                 return static::join($__data, __str::COMMA_SPACE);
  1134.                
  1135.             $l = array_pop($__data);
  1136.             return static::concatSpace(static::join($__data, __str::COMMA_SPACE), $__beforeLast, $l);
  1137.         }
  1138.         #::
  1139.        
  1140.         #:concat:
  1141.         static function concatDir($__stringN)
  1142.         {
  1143.             return static::joinDir(func_get_args());
  1144.         }
  1145.        
  1146.         static function concatDot($__stringN)
  1147.         {
  1148.             return static::joinDot(func_get_args());
  1149.         }
  1150.        
  1151.         static function concatEoL($__stringN)
  1152.         {
  1153.             return static::joinEoL(func_get_args());
  1154.         }
  1155.        
  1156.         static function concatPath($__stringN)
  1157.         {
  1158.             return static::joinPath(func_get_args());
  1159.         }
  1160.        
  1161.         static function concatPlus($__stringN)
  1162.         {
  1163.             return static::joinPlus(func_get_args());
  1164.         }
  1165.        
  1166.         static function concatSlash($__stringN)
  1167.         {
  1168.             return static::joinSlash(func_get_args());
  1169.         }
  1170.        
  1171.         static function concatSpace($__stringN)
  1172.         {
  1173.             return static::joinSpace(func_get_args());
  1174.         }
  1175.        
  1176.         static function concatUnderscore($__stringN)
  1177.         {
  1178.             return static::joinUnderscore(func_get_args());
  1179.         }
  1180.         #::
  1181.        
  1182.         #:pad:
  1183.         static function lPad($__string, $__length, $__delimiter)
  1184.         {
  1185.             return static::pad($__string, $__length, $__delimiter, STR_PAD_LEFT);
  1186.         }
  1187.        
  1188.         static function lPadDot($__string, $__length)
  1189.         {
  1190.             return static::lPad($__string, $__length, __str::DOT);
  1191.         }
  1192.        
  1193.         static function lPadSpace($__string, $__length)
  1194.         {
  1195.             return static::lPad($__string, $__length, __str::SPACE);
  1196.         }
  1197.        
  1198.         static function rPad($__string, $__length, $__delimiter)
  1199.         {
  1200.             return static::pad($__string, $__length, $__delimiter, STR_PAD_RIGHT);
  1201.         }
  1202.        
  1203.         static function rPadDot($__string, $__length)
  1204.         {
  1205.             return static::rPad($__string, $__length, __str::DOT);
  1206.         }
  1207.        
  1208.         static function rPadSpace($__string, $__length)
  1209.         {
  1210.             return static::rPad($__string, $__length, __str::SPACE);
  1211.         }
  1212.         #::
  1213.        
  1214.         #:repeat:
  1215.         static function repeatDot($__length)
  1216.         {
  1217.             return static::repeat(__str::DOT, $__length);
  1218.         }
  1219.        
  1220.         static function repeatEoL($__length)
  1221.         {
  1222.             return static::repeat(__str::EOL, $__length);
  1223.         }
  1224.        
  1225.         static function repeatSpace($__length)
  1226.         {
  1227.             return static::repeat(__str::SPACE, $__length);
  1228.         }
  1229.        
  1230.         static function repeatTab($__length)
  1231.         {
  1232.             return static::repeat(chr(__chr::TAB), $__length);
  1233.         }
  1234.         #::
  1235.        
  1236.         #:chrOffset:
  1237.         static function lChrOffset($__string, $__char, $__until = 0x01)
  1238.         {
  1239.             return static::__chrOffset($__string, $__char, FALSE, $__until);
  1240.         }
  1241.        
  1242.         static function rChrOffset($__string, $__char, $__until = 0x01)
  1243.         {
  1244.             return static::__chrOffset($__string, $__char, TRUE, $__until);
  1245.         }
  1246.        
  1247.         protected function __chrOffset($__string, $__char, $__reverse, $__until = 0x01)
  1248.         {
  1249.             $i = 0x00;
  1250.             $l = 0x00;
  1251.             $r = TRUE === $__reverse
  1252.                 ? static::reverse($__string, FALSE)
  1253.                 : static::split($__string, FALSE);
  1254.            
  1255.             foreach($r as $c)
  1256.             {
  1257.                 if($c === $__char
  1258.                 && ++$i === $__until)
  1259.                     return $l;
  1260.                
  1261.                 $l++;
  1262.             }
  1263.            
  1264.             return FALSE;
  1265.         }
  1266.         #::
  1267.        
  1268.         #:sub:
  1269.         static function lSub($__string, $__char, $__until = 0x01, $__length = NULL)
  1270.         {
  1271.             if(FALSE === ($o = static::lChrOffset($__string, $__char, $__until)))
  1272.                 return NULL;
  1273.            
  1274.             return 0x03 >= func_num_args()
  1275.                 ? static::sub(static::sub($__string, 0, $o), -$o)
  1276.                 : static::sub(static::sub($__string, 0, $o), -$o, $__length);
  1277.         }
  1278.            
  1279.         static function rSub($__string, $__char, $__until = 0x01, $__length = NULL)
  1280.         {
  1281.             if(FALSE === ($o = static::rChrOffset($__string, $__char, $__until)))
  1282.                 return NULL;
  1283.            
  1284.             return 0x03 >= func_num_args()
  1285.                 ? static::sub($__string, -$o)
  1286.                 : static::sub($__string, -$o, $__length);
  1287.         }
  1288.         #::
  1289.        
  1290.         #:is:
  1291.         static function lIs($__string, $__search)
  1292.         {
  1293.             return static::sub($__string, 0x00, static::len($__search)) === $__search;
  1294.         }
  1295.        
  1296.         static function rIs($__string, $__search)
  1297.         {
  1298.             return static::sub($__string, -static::len($__search)) === $__search;
  1299.         }  
  1300.         #::
  1301.        
  1302.         #:count:
  1303.         static function lCount($__string, $__search)
  1304.         {
  1305.             $c = 0x00;
  1306.             $s = $__string;
  1307.            
  1308.             while(static::lIs($s, $__search) && ++$c)
  1309.                 $s = static::lCut($s, $__search, FALSE);
  1310.                
  1311.             return $c;
  1312.         }
  1313.        
  1314.         static function rCount($__string, $__search)
  1315.         {
  1316.             $c = 0x00;
  1317.             $s = $__string;
  1318.            
  1319.             while(static::rIs($s, $__search) && ++$c)
  1320.                 $s = static::rCut($s, $__search, FALSE);
  1321.                
  1322.             return $c;
  1323.         }
  1324.         #::
  1325.        
  1326.         #:cut:
  1327.         static function lCut($__string, $__search, $__deep = FALSE)
  1328.         {
  1329.             if(is_array($__search))
  1330.             {
  1331.                 foreach($__search as $s)
  1332.                     $__string = static::lCut($__string, $s, $__deep);
  1333.                
  1334.                 return $__string;
  1335.             }
  1336.            
  1337.             if(FALSE === $__deep || 0x01 === $__deep)
  1338.                 return FALSE === static::lIs($__string, $__search)
  1339.                     ? $__string
  1340.                     : static::sub($__string, static::len($__search));
  1341.            
  1342.             $m = 0x00;
  1343.             $d = (int) $__deep;
  1344.            
  1345.             while(static::lIs($__string, $__search))
  1346.             {
  1347.                 if(TRUE !== $__deep && $m++ === $d)
  1348.                     break;
  1349.                
  1350.                 $__string = static::lCut($__string, $__search, FALSE);
  1351.             }
  1352.                
  1353.             return $__string;
  1354.         }
  1355.        
  1356.         static function rCut($__string, $__search, $__deep = FALSE)
  1357.         {
  1358.             if(is_array($__search))
  1359.             {
  1360.                 foreach($__search as $s)
  1361.                     $__string = static::rCut($__string, $s, $__deep);
  1362.                
  1363.                 return $__string;
  1364.             }
  1365.            
  1366.             if(FALSE === $__deep || 0x01 === $__deep)
  1367.                 return FALSE === static::rIs($__string, $__search)
  1368.                     ? $__string
  1369.                     : static::sub($__string, 0x00, -static::len($__search));
  1370.            
  1371.             $m = 0x00;
  1372.             $d = (int) $__deep;
  1373.            
  1374.             while(static::rIs($__string, $__search))
  1375.             {
  1376.                 if(TRUE !== $__deep && $m++ === $d)
  1377.                     break;
  1378.                
  1379.                 $__string = static::rCut($__string, $__search, FALSE);
  1380.             }
  1381.                
  1382.             return $__string;
  1383.         }
  1384.         #::
  1385.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement