Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- namespace ILLI\Core\Util;
- use ILLI\Core\Std\DefaultStatic\__import_IDefaultStatic;
- use ILLI\Core\Std\IDefaultStatic;
- use ILLI\Core\Util\Arr;
- class Str implements IDefaultStatic
- {
- use __import_IDefaultStatic;
- #:php:
- static function explode($__string, $__delimiter = __str::SPACE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? explode($__delimiter, $__string)
- : explode($__delimiter, $__string, $__limit);
- }
- static function f($__format, ...$__data)
- {
- $a = func_get_args();
- return sprintf(...$a);
- }
- static function join(array $__data, $__delimiter = __str::DEVOID)
- {
- return join($__delimiter, $__data);
- }
- static function len($__string)
- {
- return strlen($__string);
- }
- static function lc($__string)
- {
- return strtolower($__string);
- }
- static function lcf($__string)
- {
- return ucfirst($__string);
- }
- static function lcw($__string)
- {
- return ucwords($__string);
- }
- static function pad($__string, $__length, $__delimiter, $__case)
- {
- return str_pad($__string, $__length, $__delimiter, $__case);
- }
- static function pos($__string, $__needle, $__offset = 0x00)
- {
- return strpos($__string, $__needle, $__offset);
- }
- static function pregMatch($__string, $__pattern, $__flag = 0x00, $__offset = 0x00)
- {
- if(0x02 >= func_num_args())
- return preg_match($__pattern, $__string);
- preg_match($__pattern, $__string, $matches, $__flag, $__offset);
- return $matches;
- }
- static function split($__string, $__length = 0x01)
- {
- return str_split($__string, $__length);
- }
- static function sub($__string, $__start, $__length = NULL)
- {
- return 0x02 >= func_num_args()
- ? substr($__string, $__start)
- : substr($__string, $__start, $__length);
- }
- static function tr($__string, $__from, $__to = NULL)
- {
- return 0x02 >= func_num_args()
- ? strtr($__string, $__from)
- : strtr($__string, $__from, $__to);
- }
- static function uc($__string)
- {
- return strtoupper($__string);
- }
- static function ucf($__string)
- {
- return ucfirst($__string);
- }
- static function ucw($__string)
- {
- return ucwords($__string);
- }
- static function repeat($__string, $__length)
- {
- return str_repeat($__string, $__length);
- }
- static function replace($__string, $__search, $__replace)
- {
- return str_replace($__search, $__replace, $__string);
- }
- #::
- #:mod:
- static function prependBom($__string = NULL)
- {
- return chr(255).chr(254).$__string;
- }
- static function hex($__integer)
- {
- return static::pat('0x{:hex}', ['hex' => dechex((int) $__integer)]);
- }
- static function x($__integer)
- {
- return static::pat('\x{:hex}', ['hex' => dechex((int) $__integer)]);
- }
- #::
- #:tests:
- static function isUtf8($__mixed)
- {
- return TRUE === is_string($__mixed) && 0x01 === preg_match('/^.*$/us', $__mixed);
- }
- #::
- #:aggregate:
- static function concat($__stringN)
- {
- return static::join(func_get_args(), __str::DEVOID);
- }
- static function lcfi($__string)
- {
- return static::lcf(static::uc($__string));
- }
- static function lcwi($__string)
- {
- return static::lcw(static::uc($__string));
- }
- static function match($__string, $__pattern, array $__options = [])
- {
- $__options += [
- 'matches' => FALSE,
- 'mod' => '',
- 'flag' => 0,
- 'offset' => 0,
- 'escapeSlash' => TRUE,
- 'format' => FALSE
- ];
- if(FALSE !== $__options['format'])
- $__pattern = static::insert($__pattern, $__options['format']);
- $__pattern = static::concat
- (
- __str::SLASH,
- TRUE === $__options['escapeSlash']
- ? static::replace($__pattern, __str::SLASH, __str::ESLASH)
- : $__pattern,
- __str::SLASH,
- $__options['mod']
- );
- return FALSE === $__options['matches']
- ? (bool) static::pregMatch($__pattern, $__string)
- : static::pregMatch($__pattern, $__string, $__options['flag'], $__options['offset']);
- }
- static function ucfi($__string)
- {
- return static::ucf(static::lc($__string));
- }
- static function ucwi($__string)
- {
- return static::ucw(static::lc($__string));
- }
- #::
- #:chr:
- static function insert($__string, $__insert, $__index, $__concat = TRUE, $__length = 0x01)
- {
- $r = static::split($__string, $__length);
- array_splice($r, $__index, 0x00, $__insert);
- return TRUE === $__concat ? static::join($r) : $r;
- }
- static function range($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
- {
- $r = static::split($__string, $__length);
- return TRUE === $__concat
- ? [
- 0x00 => static::join(array_slice($r, 0x00, $__index)),
- 0x01 => static::join(array_slice($r, $__index, $__count)),
- 0x02 => static::join(array_slice($r, $__index + $__count))
- ]
- : [
- 0x00 => array_slice($r, 0x00, $__index),
- 0x01 => array_slice($r, $__index, $__count),
- 0x02 => array_slice($r, $__index + $__count)
- ];
- }
- static function remove($__string, $__index, $__concat = TRUE, $__length = 0x01)
- {
- $r = static::split($__string, $__length);
- unset($r[$__index]);
- return TRUE === $__concat ? static::join($r) : $r;
- }
- static function removeRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
- {
- $r = static::range($__string, $__index, $__count, TRUE, $__length);
- unset($r[0x01]);
- return TRUE === $__concat ? static::join($r) : $r;
- }
- static function reverse($__string, $__concat = TRUE, $__length = 0x01)
- {
- $r = array_reverse(static::split($__string, $__length));
- return TRUE === $__concat ? static::join($r) : $r;
- }
- static function reverseRange($__string, $__index, $__count, $__concat = TRUE, $__length = 0x01)
- {
- $r = static::range($__string, $__index, $__count, FALSE, $__length);
- $r[0x01] = array_reverse($r[0x01]);
- $r[0x00] = static::join($r[0x00]);
- $r[0x01] = static::join($r[0x01]);
- $r[0x02] = static::join($r[0x02]);
- return TRUE === $__concat ? static::join($r) : $r;
- }
- #::
- #:sequence:
- static function insertAt($__string, $__delimiter, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x05 >= func_num_args()
- ? static::explode($__string, $__delimiter)
- : static::explode($__string, $__delimiter, $__limit);
- array_splice($r, $__index, 0x00, $__insert);
- return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
- }
- static function rangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x05 >= func_num_args()
- ? static::explode($__string, $__delimiter)
- : static::explode($__string, $__delimiter, $__limit);
- return TRUE === $__concat
- ? [
- 0x00 => static::join(array_slice($r, 0x00, $__index), $__delimiter),
- 0x01 => static::join(array_slice($r, $__index, $__count), $__delimiter),
- 0x02 => static::join(array_slice($r, $__index + $__count), $__delimiter)
- ]
- : [
- 0x00 => array_slice($r, 0x00, $__index),
- 0x01 => array_slice($r, $__index, $__count),
- 0x02 => array_slice($r, $__index + $__count)
- ];
- }
- static function removeAt($__string, $__delimiter, $__index, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x03 >= func_num_args()
- ? static::explode($__string, $__delimiter)
- : static::explode($__string, $__delimiter, $__limit);
- unset($r[$__index]);
- return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
- }
- static function removeRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x05 >= func_num_args()
- ? static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE)
- : static::rangeAt($__string, $__delimiter, $__index, $__count, TRUE, $__limit);
- unset($r[0x01]);
- return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
- }
- static function reverseAt($__string, $__delimiter, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x03 >= func_num_args()
- ? static::explode($__string, $__delimiter)
- : static::explode($__string, $__delimiter, $__limit);
- $r = array_reverse($r);
- return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
- }
- static function reverseRangeAt($__string, $__delimiter, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- $r = 0x05 >= func_num_args()
- ? static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE)
- : static::rangeAt($__string, $__delimiter, $__index, $__count, FALSE, $__limit);
- $r[0x01] = array_reverse($r[0x01]);
- $r[0x00] = static::join($r[0x00], $__delimiter);
- $r[0x01] = static::join($r[0x01], $__delimiter);
- $r[0x02] = static::join($r[0x02], $__delimiter);
- return TRUE === $__concat ? static::join($r, $__delimiter) : $r;
- }
- #::
- #:insertAt:
- static function insertAtDir($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::DIR, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtDot($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::DOT, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtEoL($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::EOL, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtMinus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::MINUS, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtPath($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::PATH, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtPlus($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::PLUS, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtSlash($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::SLASH, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtSpace($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::SPACE, $__insert, $__index, $__concat, $__limit);
- }
- static function insertAtUnderscore($__string, $__insert, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat)
- : static::insertAt($__string, __str::UNDERSCORE, $__insert, $__index, $__concat, $__limit);
- }
- #::
- #:rangeAt:
- static function rangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
- }
- static function rangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
- : static::rangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
- }
- #::
- #:removeAt:
- static function removeAtDir($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::DIR, $__index, $__concat)
- : static::removeAt($__string, __str::DIR, $__index, $__concat, $__limit);
- }
- static function removeAtDot($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::DOT, $__index, $__concat)
- : static::removeAt($__string, __str::DOT, $__index, $__concat, $__limit);
- }
- static function removeAtEoL($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::EOL, $__index, $__concat)
- : static::removeAt($__string, __str::EOL, $__index, $__concat, $__limit);
- }
- static function removeAtMinus($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::MINUS, $__index, $__concat)
- : static::removeAt($__string, __str::MINUS, $__index, $__concat, $__limit);
- }
- static function removeAtPath($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::PATH, $__index, $__concat)
- : static::removeAt($__string, __str::PATH, $__index, $__concat, $__limit);
- }
- static function removeAtPlus($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::PLUS, $__index, $__concat)
- : static::removeAt($__string, __str::PLUS, $__index, $__concat, $__limit);
- }
- static function removeAtSlash($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::SLASH, $__index, $__concat)
- : static::removeAt($__string, __str::SLASH, $__index, $__concat, $__limit);
- }
- static function removeAtSpace($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::SPACE, $__index, $__concat)
- : static::removeAt($__string, __str::SPACE, $__index, $__concat, $__limit);
- }
- static function removeAtUnderscore($__string, $__index, $__concat = TRUE, $__limit = NULL)
- {
- return 0x03 >= func_num_args()
- ? static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat)
- : static::removeAt($__string, __str::UNDERSCORE, $__index, $__concat, $__limit);
- }
- #::
- #:removeRangeAt:
- static function removeRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
- }
- static function removeRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
- : static::removeRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
- }
- #::
- #:reverseAt:
- static function reverseAtDir($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::DIR, $__concat)
- : static::reverseAt($__string, __str::DIR, $__concat, $__limit);
- }
- static function reverseAtDot($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::DOT, $__concat)
- : static::reverseAt($__string, __str::DOT, $__concat, $__limit);
- }
- static function reverseAtEoL($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::EOL, $__concat)
- : static::reverseAt($__string, __str::EOL, $__concat, $__limit);
- }
- static function reverseAtMinus($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::MINUS, $__concat)
- : static::reverseAt($__string, __str::MINUS, $__concat, $__limit);
- }
- static function reverseAtPath($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::PATH, $__concat)
- : static::reverseAt($__string, __str::PATH, $__concat, $__limit);
- }
- static function reverseAtPlus($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::PLUS, $__concat)
- : static::reverseAt($__string, __str::PLUS, $__concat, $__limit);
- }
- static function reverseAtSlash($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::SLASH, $__concat)
- : static::reverseAt($__string, __str::SLASH, $__concat, $__limit);
- }
- static function reverseAtSpace($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::SPACE, $__concat)
- : static::reverseAt($__string, __str::SPACE, $__concat, $__limit);
- }
- static function reverseAtUnderscore($__string, $__concat = TRUE, $__limit = NULL)
- {
- return 0x02 >= func_num_args()
- ? static::reverseAt($__string, __str::UNDERSCORE, $__concat)
- : static::reverseAt($__string, __str::UNDERSCORE, $__concat, $__limit);
- }
- #::
- #:reverseRangeAt:
- static function reverseRangeAtDir($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::DIR, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtDot($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::DOT, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtEoL($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::EOL, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtMinus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::MINUS, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtPath($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::PATH, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtPlus($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::PLUS, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtSlash($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::SLASH, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtSpace($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::SPACE, $__index, $__count, $__concat, $__limit);
- }
- static function reverseRangeAtUnderscore($__string, $__index, $__count, $__concat = TRUE, $__limit = NULL)
- {
- return 0x04 >= func_num_args()
- ? static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat)
- : static::reverseRangeAt($__string, __str::UNDERSCORE, $__index, $__count, $__concat, $__limit);
- }
- #::
- #:explode:
- static function explodeDir($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::DIR)
- : static::explode($__string, __str::DIR, $__limit);
- }
- static function explodeDot($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::DOT)
- : static::explode($__string, __str::DOT, $__limit);
- }
- static function explodeEoL($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::EOL)
- : static::explode($__string, __str::EOL, $__limit);
- }
- static function explodeMinus($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::MINUS)
- : static::explode($__string, __str::MINUS, $__limit);
- }
- static function explodePath($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::PATH)
- : static::explode($__string, __str::PATH, $__limit);
- }
- static function explodePlus($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::PLUS)
- : static::explode($__string, __str::PLUS, $__limit);
- }
- static function explodeSlash($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::SLASH)
- : static::explode($__string, __str::SLASH, $__limit);
- }
- static function explodeSpace($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::SPACE)
- : static::explode($__string, __str::SPACE, $__limit);
- }
- static function explodeUnderscore($__string, $__limit = NULL)
- {
- return 0x01 >= func_num_args()
- ? static::explode($__string, __str::UNDERSCORE)
- : static::explode($__string, __str::UNDERSCORE, $__limit);
- }
- #::
- #:join:
- static function joinDir(array $__data)
- {
- return static::join($__data, __str::DIR);
- }
- static function joinDot(array $__data)
- {
- return static::join($__data, __str::DOT);
- }
- static function joinEoL(array $__data)
- {
- return static::join($__data, __str::EOL);
- }
- static function joinMinus(array $__data)
- {
- return static::join($__data, __str::MINUS);
- }
- static function joinPath(array $__data)
- {
- return static::join($__data, __str::PATH);
- }
- static function joinPlus(array $__data)
- {
- return static::join($__data, __str::PLUS);
- }
- static function joinSlash(array $__data)
- {
- return static::join($__data, __str::SLASH);
- }
- static function joinSpace(array $__data)
- {
- return static::join($__data, __str::SPACE);
- }
- static function joinUnderscore(array $__data)
- {
- return static::join($__data, __str::UNDERSCORE);
- }
- static function joinWords(array $__data, $__beforeLast = NULL)
- {
- if(NULL === $__beforeLast || 0x01 >= count($__data))
- return static::join($__data, __str::COMMA_SPACE);
- $l = array_pop($__data);
- return static::concatSpace(static::join($__data, __str::COMMA_SPACE), $__beforeLast, $l);
- }
- #::
- #:concat:
- static function concatDir($__stringN)
- {
- return static::joinDir(func_get_args());
- }
- static function concatDot($__stringN)
- {
- return static::joinDot(func_get_args());
- }
- static function concatEoL($__stringN)
- {
- return static::joinEoL(func_get_args());
- }
- static function concatPath($__stringN)
- {
- return static::joinPath(func_get_args());
- }
- static function concatPlus($__stringN)
- {
- return static::joinPlus(func_get_args());
- }
- static function concatSlash($__stringN)
- {
- return static::joinSlash(func_get_args());
- }
- static function concatSpace($__stringN)
- {
- return static::joinSpace(func_get_args());
- }
- static function concatUnderscore($__stringN)
- {
- return static::joinUnderscore(func_get_args());
- }
- #::
- #:pad:
- static function leftPad($__string, $__length, $__delimiter)
- {
- return static::pad($__string, $__length, $__delimiter, STR_PAD_LEFT);
- }
- static function leftPadDot($__string, $__length)
- {
- return static::leftPad($__string, $__length, __str::DOT);
- }
- static function leftPadSpace($__string, $__length)
- {
- return static::leftPad($__string, $__length, __str::SPACE);
- }
- static function rightPad($__string, $__length, $__delimiter)
- {
- return static::pad($__string, $__length, $__delimiter, STR_PAD_RIGHT);
- }
- static function rightPadDot($__string, $__length)
- {
- return static::rightPad($__string, $__length, __str::DOT);
- }
- static function rightPadSpace($__string, $__length)
- {
- return static::rightPad($__string, $__length, __str::SPACE);
- }
- #::
- #:repeat:
- static function repeatDot($__length)
- {
- return static::repeat(__str::DOT, $__length);
- }
- static function repeatEoL($__length)
- {
- return static::repeat(__str::EOL, $__length);
- }
- static function repeatSpace($__length)
- {
- return static::repeat(__str::SPACE, $__length);
- }
- static function repeatTab($__length)
- {
- return static::repeat(chr(__chr::TAB), $__length);
- }
- #::
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement