<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($LgtSN, $ZftC_ = null, $AIq00 = null, $A9SL0 = '*') { goto vjHtE; equG2: return $DAi4f; goto GnkVd; LAtV2: if (null == $AIq00) { $AIq00 = $ZftC_ + floor($Z4nIS / 2); } goto pdE3U; XgD7S: if ($AIq00 < $Z4nIS - 1) { $DAi4f .= mb_substr($LgtSN, $AIq00 + 1); } goto equG2; pdE3U: if ($ZftC_ < 0) { $ZftC_ = 0; } goto V8n1s; ftjd3: $DAi4f = ''; goto Y6hHc; vjHtE: $Z4nIS = mb_strlen($LgtSN); goto JsKNV; JsKNV: if (null == $ZftC_) { $ZftC_ = floor($Z4nIS / 2); } goto LAtV2; Y6hHc: if ($ZftC_ > 0) { $DAi4f .= mb_substr($LgtSN, 0, $ZftC_); } goto I6S_M; I6S_M: $DAi4f .= str_repeat($A9SL0, $AIq00 - $ZftC_ + 1); goto XgD7S; V8n1s: if ($AIq00 >= $Z4nIS - 1) { $AIq00 = $Z4nIS - 1; } goto ftjd3; GnkVd: } public static function passwordStrength($Oedtb) { goto AJct7; f7mZR: return $GHiqO; goto URaQf; mdX7e: $Oedtb = preg_replace('/\\d+/', '', $Oedtb); goto BIrMw; BIrMw: if (!empty($Oedtb)) { $GHiqO++; } goto yyEZy; dXJCJ: $Oedtb = preg_replace('/[A-Z]+/', '', $Oedtb); goto UE6UK; O9_aW: if (!empty($Oedtb)) { $GHiqO++; } goto mdX7e; AJct7: $GHiqO = 0; goto O9_aW; yyEZy: $Oedtb = preg_replace('/[a-z]+/', '', $Oedtb); goto SLY7k; SLY7k: if (!empty($Oedtb)) { $GHiqO++; } goto dXJCJ; UE6UK: if (!empty($Oedtb)) { $GHiqO++; } goto f7mZR; URaQf: } public static function camelize($QPrJy, $Kt8we = '_') { $QPrJy = $Kt8we . str_replace($Kt8we, ' ', strtolower($QPrJy)); return ltrim(str_replace(' ', '', ucwords($QPrJy)), $Kt8we); } public static function uncamelize($nnYI9, $Kt8we = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $Kt8we . '$2', $nnYI9)); } public static function startWith($WiNfD, $DyAPP) { foreach ((array) $DyAPP as $j3ZDT) { if ($j3ZDT != '' && mb_strpos($WiNfD, $j3ZDT) === 0) { return true; } } return false; } public static function filterSpecialChars($Gttsd) { $Y3W0L = array('​', '‌', '‍'); return str_replace($Y3W0L, '', $Gttsd); } public static function limit($McuDg, $CcreL = 100, $uqLdQ = '...') { return Str::limit($McuDg, $CcreL, $uqLdQ); } public static function mbLimit($McuDg, $CcreL) { return Str::limit($McuDg, $CcreL, ''); } public static function mbLimitChars($McuDg, $CcreL) { goto aICWw; nRJt8: $DKjda = 0; goto f6ggC; TfNx4: return $k5bLx; goto orXPW; ZMsoQ: foreach ($Y3W0L as $yGfjD) { goto ongsN; ongsN: $DKjda += strlen($yGfjD); goto S1XOq; C0jZf: $k5bLx .= $yGfjD; goto KtaY_; S1XOq: if ($DKjda > $CcreL) { break; } goto C0jZf; KtaY_: } goto TfNx4; aICWw: $Y3W0L = mb_str_split($McuDg, 1, 'UTF-8'); goto nRJt8; f6ggC: $k5bLx = ''; goto ZMsoQ; orXPW: } public static function mbLength($McuDg) { if (empty($McuDg)) { return 0; } return intval(mb_strlen($McuDg, 'UTF-8')); } public static function mbLengthGt($McuDg, $CcreL) { return self::mbLength($McuDg) > $CcreL; } public static function mbWordwrap($gtzum, $NxzmO = 75, $pRS63 = '
') { goto ogBYC; clvK9: $zD6Du = mb_strlen($gtzum); goto qiyq0; aUQFo: return $trLLJ; goto CEGUs; WWA0o: $ap96d = $WtMaN = 0; goto M08U6; qiyq0: $rNgdY = mb_strlen($pRS63); goto tZZSJ; tZZSJ: $trLLJ = ''; goto WWA0o; ogBYC: if ($gtzum === '') { return ''; } goto X78cl; T8x4f: if ($ap96d !== $xazOZ) { $trLLJ .= mb_substr($gtzum, $ap96d, $xazOZ - $ap96d); } goto aUQFo; X78cl: if (strlen($gtzum) === mb_strlen($gtzum)) { return wordwrap($gtzum, $NxzmO, $pRS63, true); } goto clvK9; M08U6: for ($xazOZ = 0; $xazOZ < $zD6Du; $xazOZ++) { $yGfjD = mb_substr($gtzum, $xazOZ, 1); $fGmqq = $yGfjD; if ($rNgdY !== 1) { $fGmqq = mb_substr($gtzum, $xazOZ, $rNgdY); } if ($fGmqq === $pRS63) { goto l0eJm; AeHIb: $xazOZ += $rNgdY - 1; goto WEWZt; QgS9A: continue; goto A80OF; l0eJm: $trLLJ .= mb_substr($gtzum, $ap96d, $xazOZ - $ap96d + $rNgdY); goto AeHIb; WEWZt: $ap96d = $WtMaN = $xazOZ + 1; goto QgS9A; A80OF: } if ($yGfjD === ' ') { goto G6mAe; NsfeS: $WtMaN = $xazOZ; goto UenqZ; G6mAe: if ($xazOZ - $ap96d >= $NxzmO) { $trLLJ .= mb_substr($gtzum, $ap96d, $xazOZ - $ap96d) . $pRS63; $ap96d = $xazOZ + 1; } goto NsfeS; UenqZ: continue; goto daRnA; daRnA: } if ($xazOZ - $ap96d >= $NxzmO && $ap96d >= $WtMaN) { goto lok6o; KhaA7: continue; goto g00Kk; yfxtx: $ap96d = $WtMaN = $xazOZ; goto KhaA7; lok6o: $trLLJ .= mb_substr($gtzum, $ap96d, $xazOZ - $ap96d) . $pRS63; goto yfxtx; g00Kk: } if ($xazOZ - $ap96d >= $NxzmO && $ap96d < $WtMaN) { goto H1JtW; H1JtW: $trLLJ .= mb_substr($gtzum, $ap96d, $WtMaN - $ap96d) . $pRS63; goto KVuSN; sQRXT: continue; goto Omyxx; KVuSN: $ap96d = $WtMaN = $WtMaN + 1; goto sQRXT; Omyxx: } } goto T8x4f; CEGUs: } public static function split($McuDg, $TeVpf = ',', $mAx46 = array('，', ';', '；')) { goto qBWB9; pHA54: return $q2nIJ; goto OpNqh; XVqLk: $q2nIJ = explode($TeVpf, $McuDg); goto qC137; qC137: $q2nIJ = array_map('trim', $q2nIJ); goto nzrWD; qBWB9: $McuDg = str_replace($mAx46, $TeVpf, $McuDg); goto XVqLk; nzrWD: $q2nIJ = array_filter($q2nIJ); goto pHA54; OpNqh: } public static function wordSplit($Afv_G) { if (modstart_module_enabled('WordSpliter')) { $TDAzu = \Module\WordSpliter\Util\WordSpliterUtil::cut($Afv_G); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $Afv_G, $WpF0C); $TDAzu = array_filter($WpF0C[0]); } return $TDAzu; } }