<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($jUmSm, $MDDvN = null, $jonKz = null, $CjPX3 = '*') { goto sh4Ce; hRLno: return $NzhrY; goto WVFFZ; O3828: if ($jonKz >= $rsM2m - 1) { $jonKz = $rsM2m - 1; } goto Yzt1h; CWahS: if ($jonKz < $rsM2m - 1) { $NzhrY .= mb_substr($jUmSm, $jonKz + 1); } goto hRLno; xP_ei: if ($MDDvN < 0) { $MDDvN = 0; } goto O3828; vO3gg: if ($MDDvN > 0) { $NzhrY .= mb_substr($jUmSm, 0, $MDDvN); } goto KL4GX; KL4GX: $NzhrY .= str_repeat($CjPX3, $jonKz - $MDDvN + 1); goto CWahS; Yzt1h: $NzhrY = ''; goto vO3gg; c93iO: if (null == $MDDvN) { $MDDvN = floor($rsM2m / 2); } goto dLTeQ; sh4Ce: $rsM2m = mb_strlen($jUmSm); goto c93iO; dLTeQ: if (null == $jonKz) { $jonKz = $MDDvN + floor($rsM2m / 2); } goto xP_ei; WVFFZ: } public static function passwordStrength($V3jYa) { goto MF5z0; r8Fe3: $V3jYa = preg_replace('/\\d+/', '', $V3jYa); goto OyfET; MF5z0: $FUDQJ = 0; goto zC33N; w8usf: if (!empty($V3jYa)) { $FUDQJ++; } goto bF5MB; zC33N: if (!empty($V3jYa)) { $FUDQJ++; } goto r8Fe3; czMf1: $V3jYa = preg_replace('/[a-z]+/', '', $V3jYa); goto qpjeC; OyfET: if (!empty($V3jYa)) { $FUDQJ++; } goto czMf1; bF5MB: return $FUDQJ; goto M1xrm; qpjeC: if (!empty($V3jYa)) { $FUDQJ++; } goto GIYiV; GIYiV: $V3jYa = preg_replace('/[A-Z]+/', '', $V3jYa); goto w8usf; M1xrm: } public static function camelize($yyVl2, $LCTKo = '_') { $yyVl2 = $LCTKo . str_replace($LCTKo, ' ', strtolower($yyVl2)); return ltrim(str_replace(' ', '', ucwords($yyVl2)), $LCTKo); } public static function uncamelize($Ol1rL, $LCTKo = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $LCTKo . '$2', $Ol1rL)); } public static function startWith($bhzAd, $Zgrdq) { foreach ((array) $Zgrdq as $uU3oW) { if ($uU3oW != '' && mb_strpos($bhzAd, $uU3oW) === 0) { return true; } } return false; } public static function filterSpecialChars($Mczr_) { $LQAO8 = array('​', '‌', '‍'); return str_replace($LQAO8, '', $Mczr_); } public static function limit($WKfeb, $JAcjY = 100, $g106V = '...') { return Str::limit($WKfeb, $JAcjY, $g106V); } public static function mbLimit($WKfeb, $JAcjY) { return Str::limit($WKfeb, $JAcjY, ''); } public static function mbLimitChars($WKfeb, $JAcjY) { goto tcYYO; cQ7HY: $aXxwB = 0; goto R5jUP; mCiNZ: foreach ($LQAO8 as $Wir02) { goto ACiaB; ACiaB: $aXxwB += strlen($Wir02); goto oeDNN; oeDNN: if ($aXxwB > $JAcjY) { break; } goto gi5y6; gi5y6: $DXCyn .= $Wir02; goto y7Vpf; y7Vpf: } goto Itqv1; R5jUP: $DXCyn = ''; goto mCiNZ; Itqv1: return $DXCyn; goto mB05Z; tcYYO: $LQAO8 = mb_str_split($WKfeb, 1, 'UTF-8'); goto cQ7HY; mB05Z: } public static function mbLength($WKfeb) { if (empty($WKfeb)) { return 0; } return intval(mb_strlen($WKfeb, 'UTF-8')); } public static function mbLengthGt($WKfeb, $JAcjY) { return self::mbLength($WKfeb) > $JAcjY; } public static function mbWordwrap($W8D7a, $pbpff = 75, $reT3s = '
') { goto EnH22; XlYzo: $K6R28 = mb_strlen($reT3s); goto nNg1k; X0UeJ: if ($AfsGZ !== $DNMee) { $WqCf1 .= mb_substr($W8D7a, $AfsGZ, $DNMee - $AfsGZ); } goto AQj9q; K0MV0: $AfsGZ = $e5jIZ = 0; goto Go9oW; AQj9q: return $WqCf1; goto kBBNV; jKZsz: if (strlen($W8D7a) === mb_strlen($W8D7a)) { return wordwrap($W8D7a, $pbpff, $reT3s, true); } goto LZqZJ; EnH22: if ($W8D7a === '') { return ''; } goto jKZsz; LZqZJ: $G1LwQ = mb_strlen($W8D7a); goto XlYzo; Go9oW: for ($DNMee = 0; $DNMee < $G1LwQ; $DNMee++) { $Wir02 = mb_substr($W8D7a, $DNMee, 1); $Yuh9H = $Wir02; if ($K6R28 !== 1) { $Yuh9H = mb_substr($W8D7a, $DNMee, $K6R28); } if ($Yuh9H === $reT3s) { goto xEQly; Vtlj4: $DNMee += $K6R28 - 1; goto oizPP; Si2Uf: continue; goto dJyRT; xEQly: $WqCf1 .= mb_substr($W8D7a, $AfsGZ, $DNMee - $AfsGZ + $K6R28); goto Vtlj4; oizPP: $AfsGZ = $e5jIZ = $DNMee + 1; goto Si2Uf; dJyRT: } if ($Wir02 === ' ') { goto elGrk; elGrk: if ($DNMee - $AfsGZ >= $pbpff) { $WqCf1 .= mb_substr($W8D7a, $AfsGZ, $DNMee - $AfsGZ) . $reT3s; $AfsGZ = $DNMee + 1; } goto zWeLd; zWeLd: $e5jIZ = $DNMee; goto lMC21; lMC21: continue; goto UZU_9; UZU_9: } if ($DNMee - $AfsGZ >= $pbpff && $AfsGZ >= $e5jIZ) { goto AeKxK; AeKxK: $WqCf1 .= mb_substr($W8D7a, $AfsGZ, $DNMee - $AfsGZ) . $reT3s; goto XvwIb; XvwIb: $AfsGZ = $e5jIZ = $DNMee; goto vJhP3; vJhP3: continue; goto b9oY1; b9oY1: } if ($DNMee - $AfsGZ >= $pbpff && $AfsGZ < $e5jIZ) { goto JXr20; cMVGx: continue; goto Z0xIg; CH7Ms: $AfsGZ = $e5jIZ = $e5jIZ + 1; goto cMVGx; JXr20: $WqCf1 .= mb_substr($W8D7a, $AfsGZ, $e5jIZ - $AfsGZ) . $reT3s; goto CH7Ms; Z0xIg: } } goto X0UeJ; nNg1k: $WqCf1 = ''; goto K0MV0; kBBNV: } public static function split($WKfeb, $MvwR5 = ',', $Gopbp = array('，', ';', '；')) { goto UIaBV; qE_QC: $rTniN = explode($MvwR5, $WKfeb); goto QA5By; UIaBV: $WKfeb = str_replace($Gopbp, $MvwR5, $WKfeb); goto qE_QC; IpV7I: return $rTniN; goto STpxx; zNl2T: $rTniN = array_filter($rTniN); goto IpV7I; QA5By: $rTniN = array_map('trim', $rTniN); goto zNl2T; STpxx: } public static function wordSplit($vVYCS) { if (modstart_module_enabled('WordSpliter')) { $q26cr = \Module\WordSpliter\Util\WordSpliterUtil::cut($vVYCS); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $vVYCS, $H_mB1); $q26cr = array_filter($H_mB1[0]); } return $q26cr; } }