Advertisement
fruffl

Class Str (bcfu)

Oct 9th, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 30.60 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.         #:mod:
  115.         static function prependBom($__string = NULL)
  116.         {
  117.             return chr(255).chr(254).$__string;
  118.         }
  119.        
  120.         static function hex($__integer)
  121.         {
  122.             return static::pat('0x{:hex}', ['hex' => dechex((int) $__integer)]);
  123.         }
  124.        
  125.         static function x($__integer)
  126.         {
  127.             return static::pat('\x{:hex}', ['hex' => dechex((int) $__integer)]);
  128.         }
  129.         #::
  130.        
  131.         #:tests:
  132.         static function isUtf8($__mixed)
  133.         {
  134.             return TRUE === is_string($__mixed) && 0x01 === preg_match('/^.*$/us', $__mixed);
  135.         }
  136.         #::
  137.        
  138.         #:aggregate:
  139.         static function concat($__stringN)
  140.         {
  141.             return static::join(func_get_args(), __str::DEVOID);
  142.         }
  143.        
  144.         static function lcfi($__string)
  145.         {
  146.             return static::lcf(static::uc($__string));
  147.         }
  148.        
  149.         static function lcwi($__string)
  150.         {
  151.             return static::lcw(static::uc($__string));
  152.         }
  153.        
  154.         static function match($__string, $__pattern, array $__options = [])
  155.         {
  156.             $__options += [
  157.                 'matches'   => FALSE,
  158.                 'mod'       => '',
  159.                 'flag'      => 0,
  160.                 'offset'    => 0,
  161.                 'escapeSlash'   => TRUE,
  162.                 'format'    => FALSE
  163.             ];
  164.            
  165.             if(FALSE !== $__options['format'])
  166.                 $__pattern = static::insert($__pattern, $__options['format']);
  167.            
  168.             $__pattern = static::concat
  169.             (
  170.                 __str::SLASH,
  171.                 TRUE === $__options['escapeSlash']
  172.                     ? static::replace($__pattern, __str::SLASH, __str::ESLASH)
  173.                     : $__pattern,
  174.                 __str::SLASH,
  175.                 $__options['mod']
  176.             );
  177.            
  178.             return FALSE === $__options['matches']
  179.                 ? (bool) static::pregMatch($__pattern, $__string)
  180.                 : static::pregMatch($__pattern, $__string, $__options['flag'], $__options['offset']);
  181.         }
  182.        
  183.         static function ucfi($__string)
  184.         {
  185.             return static::ucf(static::lc($__string));
  186.         }
  187.        
  188.         static function ucwi($__string)
  189.         {
  190.             return static::ucw(static::lc($__string));
  191.         }
  192.         #::
  193.        
  194.         #:chr:
  195.         static function insert($__string, $__insert, $__index, $__concat = TRUE, $__length = 0x01)
  196.         {
  197.             $r = static::split($__string, $__length);
  198.             array_splice($r, $__index, 0x00, $__insert);
  199.             return TRUE === $__concat ? static::join($r) : $r;
  200.         }
  201.        
  202.         static function range($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  203.         {
  204.             $r = static::split($__string, $__length);
  205.            
  206.             return TRUE === $__concat
  207.                 ? [
  208.                     0x00 => static::join(array_slice($r, 0x00, $__index)),
  209.                     0x01 => static::join(array_slice($r, $__index, $__count)),
  210.                     0x02 => static::join(array_slice($r, $__index + $__count))
  211.                 ]
  212.                 : [
  213.                     0x00 => array_slice($r, 0x00, $__index),
  214.                     0x01 => array_slice($r, $__index, $__count),
  215.                     0x02 => array_slice($r, $__index + $__count)
  216.                 ];
  217.         }
  218.        
  219.         static function remove($__string, $__index, $__concat = TRUE, $__length = 0x01)
  220.         {
  221.             $r = static::split($__string, $__length);
  222.             unset($r[$__index]);
  223.             return TRUE === $__concat ? static::join($r) : $r;
  224.         }
  225.        
  226.         static function removeRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  227.         {
  228.             $r = static::range($__string, $__index, $__count, TRUE, $__length);
  229.             unset($r[0x01]);
  230.             return TRUE === $__concat ? static::join($r) : $r;
  231.         }
  232.        
  233.         static function reverse($__string, $__concat = TRUE, $__length = 0x01)
  234.         {
  235.             $r = array_reverse(static::split($__string, $__length));
  236.             return TRUE === $__concat ? static::join($r) : $r;
  237.         }
  238.        
  239.         static function reverseRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
  240.         {
  241.             $r = static::range($__string, $__index, $__count, FALSE, $__length);
  242.            
  243.             $r[0x01] = array_reverse($r[0x01]);
  244.            
  245.             $r[0x00] = static::join($r[0x00]);
  246.             $r[0x01] = static::join($r[0x01]);
  247.             $r[0x02] = static::join($r[0x02]);
  248.            
  249.             return TRUE === $__concat ? static::join($r) : $r;
  250.         }
  251.         #::
  252.        
  253.         #:sequence:
  254.         static function insertAt($__string, $__delimiter, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  255.         {
  256.             $r = 0x05 >= func_num_args()
  257.                 ? static::explode($__string, $__delimiter)
  258.                 : static::explode($__string, $__delimiter, $__limit);
  259.            
  260.             array_splice($r, $__index, 0x00, $__insert);
  261.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  262.         }
  263.        
  264.         static function rangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  265.         {
  266.             $r = 0x05 >= func_num_args()
  267.                 ? static::explode($__string, $__delimiter)
  268.                 : static::explode($__string, $__delimiter, $__limit);
  269.            
  270.             return TRUE === $__concat
  271.                 ? [
  272.                     0x00 => static::join(array_slice($r, 0x00, $__index), $__delimiter),
  273.                     0x01 => static::join(array_slice($r, $__index, $__count), $__delimiter),
  274.                     0x02 => static::join(array_slice($r, $__index + $__count), $__delimiter)
  275.                 ]
  276.                 : [
  277.                     0x00 => array_slice($r, 0x00, $__index),
  278.                     0x01 => array_slice($r, $__index, $__count),
  279.                     0x02 => array_slice($r, $__index + $__count)
  280.                 ];
  281.         }
  282.        
  283.         static function removeAt($__string, $__delimiter, $__index, $__concat = TRUE, $__limit = NULL)
  284.         {
  285.             $r = 0x03 >= func_num_args()
  286.                 ? static::explode($__string, $__delimiter)
  287.                 : static::explode($__string, $__delimiter, $__limit);
  288.            
  289.             unset($r[$__index]);
  290.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  291.         }
  292.        
  293.         static function removeRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  294.         {
  295.             $r = 0x05 >= func_num_args()
  296.                 ? static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE)
  297.                 : static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE, $__limit);
  298.            
  299.             unset($r[0x01]);
  300.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  301.         }
  302.        
  303.         static function reverseAt($__string, $__delimiter, $__concat = TRUE, $__limit = NULL)
  304.         {
  305.             $r = 0x03 >= func_num_args()
  306.                 ? static::explode($__string, $__delimiter)
  307.                 : static::explode($__string, $__delimiter, $__limit);
  308.            
  309.             $r = array_reverse($r);
  310.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  311.         }
  312.        
  313.         static function reverseRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  314.         {
  315.             $r = 0x05 >= func_num_args()
  316.                 ? static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE)
  317.                 : static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE, $__limit);
  318.            
  319.             $r[0x01] = array_reverse($r[0x01]);
  320.            
  321.             $r[0x00] = static::join($r[0x00], $__delimiter);
  322.             $r[0x01] = static::join($r[0x01], $__delimiter);
  323.             $r[0x02] = static::join($r[0x02], $__delimiter);
  324.            
  325.             return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
  326.         }
  327.         #::
  328.        
  329.         #:insertAt:
  330.         static function insertAtDir($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  331.         {
  332.             return 0x04 >= func_num_args()
  333.                 ? static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat)
  334.                 : static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat, $__limit);
  335.         }
  336.        
  337.         static function insertAtDot($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  338.         {
  339.             return 0x04 >= func_num_args()
  340.                 ? static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat)
  341.                 : static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat, $__limit);
  342.         }
  343.        
  344.         static function insertAtEoL($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  345.         {
  346.             return 0x04 >= func_num_args()
  347.                 ? static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat)
  348.                 : static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat, $__limit);
  349.         }
  350.        
  351.         static function insertAtMinus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  352.         {
  353.             return 0x04 >= func_num_args()
  354.                 ? static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat)
  355.                 : static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat, $__limit);
  356.         }
  357.        
  358.         static function insertAtPath($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  359.         {
  360.             return 0x04 >= func_num_args()
  361.                 ? static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat)
  362.                 : static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat, $__limit);
  363.         }
  364.        
  365.         static function insertAtPlus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  366.         {
  367.             return 0x04 >= func_num_args()
  368.                 ? static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat)
  369.                 : static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat, $__limit);
  370.         }
  371.        
  372.         static function insertAtSlash($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  373.         {
  374.             return 0x04 >= func_num_args()
  375.                 ? static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat)
  376.                 : static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat, $__limit);
  377.         }
  378.        
  379.         static function insertAtSpace($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  380.         {
  381.             return 0x04 >= func_num_args()
  382.                 ? static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat)
  383.                 : static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat, $__limit);
  384.         }
  385.        
  386.         static function insertAtUnderscore($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
  387.         {
  388.             return 0x04 >= func_num_args()
  389.                 ? static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat)
  390.                 : static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat, $__limit);
  391.         }
  392.         #::
  393.        
  394.         #:rangeAt:
  395.         static function rangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  396.         {
  397.             return 0x04 >= func_num_args()
  398.                 ? static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  399.                 : static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  400.         }
  401.        
  402.         static function rangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  403.         {
  404.             return 0x04 >= func_num_args()
  405.                 ? static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  406.                 : static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  407.         }
  408.        
  409.         static function rangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  410.         {
  411.             return 0x04 >= func_num_args()
  412.                 ? static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  413.                 : static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  414.         }
  415.        
  416.         static function rangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  417.         {
  418.             return 0x04 >= func_num_args()
  419.                 ? static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  420.                 : static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  421.         }
  422.        
  423.         static function rangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  424.         {
  425.             return 0x04 >= func_num_args()
  426.                 ? static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  427.                 : static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  428.         }
  429.        
  430.         static function rangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  431.         {
  432.             return 0x04 >= func_num_args()
  433.                 ? static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  434.                 : static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  435.         }
  436.        
  437.         static function rangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  438.         {
  439.             return 0x04 >= func_num_args()
  440.                 ? static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  441.                 : static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  442.         }
  443.        
  444.         static function rangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  445.         {
  446.             return 0x04 >= func_num_args()
  447.                 ? static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  448.                 : static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  449.         }
  450.        
  451.         static function rangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  452.         {
  453.             return 0x04 >= func_num_args()
  454.                 ? static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  455.                 : static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  456.         }
  457.         #::
  458.        
  459.         #:removeAt:
  460.         static function removeAtDir($__string, $__index, $__concat = TRUE, $__limit = NULL)
  461.         {
  462.             return 0x03 >= func_num_args()
  463.                 ? static::removeAt($__string, __str::DIR, $__index, $__concat)
  464.                 : static::removeAt($__string, __str::DIR, $__index, $__concat, $__limit);
  465.         }
  466.        
  467.         static function removeAtDot($__string, $__index, $__concat = TRUE, $__limit = NULL)
  468.         {
  469.             return 0x03 >= func_num_args()
  470.                 ? static::removeAt($__string, __str::DOT, $__index, $__concat)
  471.                 : static::removeAt($__string, __str::DOT, $__index, $__concat, $__limit);
  472.         }
  473.        
  474.         static function removeAtEoL($__string, $__index, $__concat = TRUE, $__limit = NULL)
  475.         {
  476.             return 0x03 >= func_num_args()
  477.                 ? static::removeAt($__string, __str::EOL, $__index, $__concat)
  478.                 : static::removeAt($__string, __str::EOL, $__index, $__concat, $__limit);
  479.         }
  480.        
  481.         static function removeAtMinus($__string, $__index, $__concat = TRUE, $__limit = NULL)
  482.         {
  483.             return 0x03 >= func_num_args()
  484.                 ? static::removeAt($__string, __str::MINUS, $__index, $__concat)
  485.                 : static::removeAt($__string, __str::MINUS, $__index, $__concat, $__limit);
  486.         }
  487.        
  488.         static function removeAtPath($__string, $__index, $__concat = TRUE, $__limit = NULL)
  489.         {
  490.             return 0x03 >= func_num_args()
  491.                 ? static::removeAt($__string, __str::PATH, $__index, $__concat)
  492.                 : static::removeAt($__string, __str::PATH, $__index, $__concat, $__limit);
  493.         }
  494.        
  495.         static function removeAtPlus($__string, $__index, $__concat = TRUE, $__limit = NULL)
  496.         {
  497.             return 0x03 >= func_num_args()
  498.                 ? static::removeAt($__string, __str::PLUS, $__index, $__concat)
  499.                 : static::removeAt($__string, __str::PLUS, $__index, $__concat, $__limit);
  500.         }
  501.        
  502.         static function removeAtSlash($__string, $__index, $__concat = TRUE, $__limit = NULL)
  503.         {
  504.             return 0x03 >= func_num_args()
  505.                 ? static::removeAt($__string, __str::SLASH, $__index, $__concat)
  506.                 : static::removeAt($__string, __str::SLASH, $__index, $__concat, $__limit);
  507.         }
  508.        
  509.         static function removeAtSpace($__string, $__index, $__concat = TRUE, $__limit = NULL)
  510.         {
  511.             return 0x03 >= func_num_args()
  512.                 ? static::removeAt($__string, __str::SPACE, $__index, $__concat)
  513.                 : static::removeAt($__string, __str::SPACE, $__index, $__concat, $__limit);
  514.         }
  515.        
  516.         static function removeAtUnderscore($__string, $__index, $__concat = TRUE, $__limit = NULL)
  517.         {
  518.             return 0x03 >= func_num_args()
  519.                 ? static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat)
  520.                 : static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat, $__limit);
  521.         }
  522.         #::
  523.        
  524.         #:removeRangeAt:
  525.         static function removeRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  526.         {
  527.             return 0x04 >= func_num_args()
  528.                 ? static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  529.                 : static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  530.         }
  531.        
  532.         static function removeRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  533.         {
  534.             return 0x04 >= func_num_args()
  535.                 ? static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  536.                 : static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  537.         }
  538.        
  539.         static function removeRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  540.         {
  541.             return 0x04 >= func_num_args()
  542.                 ? static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  543.                 : static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  544.         }
  545.        
  546.         static function removeRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  547.         {
  548.             return 0x04 >= func_num_args()
  549.                 ? static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  550.                 : static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  551.         }
  552.        
  553.         static function removeRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  554.         {
  555.             return 0x04 >= func_num_args()
  556.                 ? static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  557.                 : static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  558.         }
  559.        
  560.         static function removeRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  561.         {
  562.             return 0x04 >= func_num_args()
  563.                 ? static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  564.                 : static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  565.         }
  566.        
  567.         static function removeRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  568.         {
  569.             return 0x04 >= func_num_args()
  570.                 ? static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  571.                 : static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  572.         }
  573.        
  574.         static function removeRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  575.         {
  576.             return 0x04 >= func_num_args()
  577.                 ? static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  578.                 : static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  579.         }
  580.        
  581.         static function removeRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  582.         {
  583.             return 0x04 >= func_num_args()
  584.                 ? static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  585.                 : static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  586.         }
  587.         #::
  588.        
  589.         #:reverseAt:
  590.         static function reverseAtDir($__string, $__concat = TRUE, $__limit = NULL)
  591.         {
  592.             return 0x02 >= func_num_args()
  593.                 ? static::reverseAt($__string, __str::DIR, $__concat)
  594.                 : static::reverseAt($__string, __str::DIR, $__concat, $__limit);
  595.         }
  596.        
  597.         static function reverseAtDot($__string, $__concat = TRUE, $__limit = NULL)
  598.         {
  599.             return 0x02 >= func_num_args()
  600.                 ? static::reverseAt($__string, __str::DOT, $__concat)
  601.                 : static::reverseAt($__string, __str::DOT, $__concat, $__limit);
  602.         }
  603.        
  604.         static function reverseAtEoL($__string, $__concat = TRUE, $__limit = NULL)
  605.         {
  606.             return 0x02 >= func_num_args()
  607.                 ? static::reverseAt($__string, __str::EOL, $__concat)
  608.                 : static::reverseAt($__string, __str::EOL, $__concat, $__limit);
  609.         }
  610.        
  611.         static function reverseAtMinus($__string, $__concat = TRUE, $__limit = NULL)
  612.         {
  613.             return 0x02 >= func_num_args()
  614.                 ? static::reverseAt($__string, __str::MINUS, $__concat)
  615.                 : static::reverseAt($__string, __str::MINUS, $__concat, $__limit);
  616.         }
  617.        
  618.         static function reverseAtPath($__string, $__concat = TRUE, $__limit = NULL)
  619.         {
  620.             return 0x02 >= func_num_args()
  621.                 ? static::reverseAt($__string, __str::PATH, $__concat)
  622.                 : static::reverseAt($__string, __str::PATH, $__concat, $__limit);
  623.         }
  624.        
  625.         static function reverseAtPlus($__string, $__concat = TRUE, $__limit = NULL)
  626.         {
  627.             return 0x02 >= func_num_args()
  628.                 ? static::reverseAt($__string, __str::PLUS, $__concat)
  629.                 : static::reverseAt($__string, __str::PLUS, $__concat, $__limit);
  630.         }
  631.        
  632.         static function reverseAtSlash($__string, $__concat = TRUE, $__limit = NULL)
  633.         {
  634.             return 0x02 >= func_num_args()
  635.                 ? static::reverseAt($__string, __str::SLASH, $__concat)
  636.                 : static::reverseAt($__string, __str::SLASH, $__concat, $__limit);
  637.         }
  638.        
  639.         static function reverseAtSpace($__string, $__concat = TRUE, $__limit = NULL)
  640.         {
  641.             return 0x02 >= func_num_args()
  642.                 ? static::reverseAt($__string, __str::SPACE, $__concat)
  643.                 : static::reverseAt($__string, __str::SPACE, $__concat, $__limit);
  644.         }
  645.        
  646.         static function reverseAtUnderscore($__string, $__concat = TRUE, $__limit = NULL)
  647.         {
  648.             return 0x02 >= func_num_args()
  649.                 ? static::reverseAt($__string, __str::UNDERSCORE, $__concat)
  650.                 : static::reverseAt($__string, __str::UNDERSCORE, $__concat, $__limit);
  651.         }
  652.         #::
  653.        
  654.         #:reverseRangeAt:
  655.         static function reverseRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  656.         {
  657.             return 0x04 >= func_num_args()
  658.                 ? static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
  659.                 : static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
  660.         }
  661.        
  662.         static function reverseRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  663.         {
  664.             return 0x04 >= func_num_args()
  665.                 ? static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
  666.                 : static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
  667.         }
  668.        
  669.         static function reverseRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  670.         {
  671.             return 0x04 >= func_num_args()
  672.                 ? static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
  673.                 : static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
  674.         }
  675.        
  676.         static function reverseRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  677.         {
  678.             return 0x04 >= func_num_args()
  679.                 ? static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
  680.                 : static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
  681.         }
  682.        
  683.         static function reverseRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  684.         {
  685.             return 0x04 >= func_num_args()
  686.                 ? static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
  687.                 : static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
  688.         }
  689.        
  690.         static function reverseRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  691.         {
  692.             return 0x04 >= func_num_args()
  693.                 ? static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
  694.                 : static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
  695.         }
  696.        
  697.         static function reverseRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  698.         {
  699.             return 0x04 >= func_num_args()
  700.                 ? static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
  701.                 : static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
  702.         }
  703.        
  704.         static function reverseRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  705.         {
  706.             return 0x04 >= func_num_args()
  707.                 ? static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
  708.                 : static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
  709.         }
  710.        
  711.         static function reverseRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
  712.         {
  713.             return 0x04 >= func_num_args()
  714.                 ? static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
  715.                 : static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
  716.         }
  717.         #::
  718.        
  719.         #:explode:
  720.         static function explodeDir($__string, $__limit = NULL)
  721.         {
  722.             return 0x01 >= func_num_args()
  723.                 ? static::explode($__string, __str::DIR)
  724.                 : static::explode($__string, __str::DIR, $__limit);
  725.         }
  726.        
  727.         static function explodeDot($__string, $__limit = NULL)
  728.         {
  729.             return 0x01 >= func_num_args()
  730.                 ? static::explode($__string, __str::DOT)
  731.                 : static::explode($__string, __str::DOT, $__limit);
  732.         }
  733.        
  734.         static function explodeEoL($__string, $__limit = NULL)
  735.         {
  736.             return 0x01 >= func_num_args()
  737.                 ? static::explode($__string, __str::EOL)
  738.                 : static::explode($__string, __str::EOL, $__limit);
  739.         }
  740.        
  741.         static function explodeMinus($__string, $__limit = NULL)
  742.         {
  743.             return 0x01 >= func_num_args()
  744.                 ? static::explode($__string, __str::MINUS)
  745.                 : static::explode($__string, __str::MINUS, $__limit);
  746.         }
  747.        
  748.         static function explodePath($__string, $__limit = NULL)
  749.         {
  750.             return 0x01 >= func_num_args()
  751.                 ? static::explode($__string, __str::PATH)
  752.                 : static::explode($__string, __str::PATH, $__limit);
  753.         }
  754.        
  755.         static function explodePlus($__string, $__limit = NULL)
  756.         {
  757.             return 0x01 >= func_num_args()
  758.                 ? static::explode($__string, __str::PLUS)
  759.                 : static::explode($__string, __str::PLUS, $__limit);
  760.         }
  761.        
  762.         static function explodeSlash($__string, $__limit = NULL)
  763.         {
  764.             return 0x01 >= func_num_args()
  765.                 ? static::explode($__string, __str::SLASH)
  766.                 : static::explode($__string, __str::SLASH, $__limit);
  767.         }
  768.        
  769.         static function explodeSpace($__string, $__limit = NULL)
  770.         {
  771.             return 0x01 >= func_num_args()
  772.                 ? static::explode($__string, __str::SPACE)
  773.                 : static::explode($__string, __str::SPACE, $__limit);
  774.         }
  775.        
  776.         static function explodeUnderscore($__string, $__limit = NULL)
  777.         {
  778.             return 0x01 >= func_num_args()
  779.                 ? static::explode($__string, __str::UNDERSCORE)
  780.                 : static::explode($__string, __str::UNDERSCORE, $__limit);
  781.         }
  782.         #::
  783.        
  784.         #:join:
  785.         static function joinDir(array $__data)
  786.         {
  787.             return static::join($__data, __str::DIR);
  788.         }
  789.        
  790.         static function joinDot(array $__data)
  791.         {
  792.             return static::join($__data, __str::DOT);
  793.         }
  794.        
  795.         static function joinEoL(array $__data)
  796.         {
  797.             return static::join($__data, __str::EOL);
  798.         }
  799.        
  800.         static function joinMinus(array $__data)
  801.         {
  802.             return static::join($__data, __str::MINUS);
  803.         }
  804.        
  805.         static function joinPath(array $__data)
  806.         {
  807.             return static::join($__data, __str::PATH);
  808.         }
  809.        
  810.         static function joinPlus(array $__data)
  811.         {
  812.             return static::join($__data, __str::PLUS);
  813.         }
  814.        
  815.         static function joinSlash(array $__data)
  816.         {
  817.             return static::join($__data, __str::SLASH);
  818.         }
  819.        
  820.         static function joinSpace(array $__data)
  821.         {
  822.             return static::join($__data, __str::SPACE);
  823.         }
  824.        
  825.         static function joinUnderscore(array $__data)
  826.         {
  827.             return static::join($__data, __str::UNDERSCORE);
  828.         }
  829.        
  830.         static function joinWords(array $__data, $__beforeLast = NULL)
  831.         {
  832.             if(NULL === $__beforeLast || 0x01 >= count($__data))
  833.                 return static::join($__data, __str::COMMA_SPACE);
  834.                
  835.             $l = array_pop($__data);
  836.             return static::concatSpace(static::join($__data, __str::COMMA_SPACE), $__beforeLast, $l);
  837.         }
  838.         #::
  839.        
  840.         #:concat:
  841.         static function concatDir($__stringN)
  842.         {
  843.             return static::joinDir(func_get_args());
  844.         }
  845.        
  846.         static function concatDot($__stringN)
  847.         {
  848.             return static::joinDot(func_get_args());
  849.         }
  850.        
  851.         static function concatEoL($__stringN)
  852.         {
  853.             return static::joinEoL(func_get_args());
  854.         }
  855.        
  856.         static function concatPath($__stringN)
  857.         {
  858.             return static::joinPath(func_get_args());
  859.         }
  860.        
  861.         static function concatPlus($__stringN)
  862.         {
  863.             return static::joinPlus(func_get_args());
  864.         }
  865.        
  866.         static function concatSlash($__stringN)
  867.         {
  868.             return static::joinSlash(func_get_args());
  869.         }
  870.        
  871.         static function concatSpace($__stringN)
  872.         {
  873.             return static::joinSpace(func_get_args());
  874.         }
  875.        
  876.         static function concatUnderscore($__stringN)
  877.         {
  878.             return static::joinUnderscore(func_get_args());
  879.         }
  880.         #::
  881.        
  882.         #:pad:
  883.         static function leftPad($__string, $__length, $__delimiter)
  884.         {
  885.             return static::pad($__string, $__length, $__delimiter, STR_PAD_LEFT);
  886.         }
  887.        
  888.         static function leftPadDot($__string, $__length)
  889.         {
  890.             return static::leftPad($__string, $__length, __str::DOT);
  891.         }
  892.        
  893.         static function leftPadSpace($__string, $__length)
  894.         {
  895.             return static::leftPad($__string, $__length, __str::SPACE);
  896.         }
  897.        
  898.         static function rightPad($__string, $__length, $__delimiter)
  899.         {
  900.             return static::pad($__string, $__length, $__delimiter, STR_PAD_RIGHT);
  901.         }
  902.        
  903.         static function rightPadDot($__string, $__length)
  904.         {
  905.             return static::rightPad($__string, $__length, __str::DOT);
  906.         }
  907.        
  908.         static function rightPadSpace($__string, $__length)
  909.         {
  910.             return static::rightPad($__string, $__length, __str::SPACE);
  911.         }
  912.         #::
  913.        
  914.         #:repeat:
  915.         static function repeatDot($__length)
  916.         {
  917.             return static::repeat(__str::DOT, $__length);
  918.         }
  919.        
  920.         static function repeatEoL($__length)
  921.         {
  922.             return static::repeat(__str::EOL, $__length);
  923.         }
  924.        
  925.         static function repeatSpace($__length)
  926.         {
  927.             return static::repeat(__str::SPACE, $__length);
  928.         }
  929.        
  930.         static function repeatTab($__length)
  931.         {
  932.             return static::repeat(chr(__chr::TAB), $__length);
  933.         }
  934.         #::
  935.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement