diff --git a/src/Random.php b/src/Random.php new file mode 100644 index 0000000000000000000000000000000000000000..6a37031dd810d3f37e5db5b293fc270eb480289e --- /dev/null +++ b/src/Random.php @@ -0,0 +1,89 @@ += 2) { + if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str)) { + $str = substr($str, 0, -1); + $i = $i - 1; + } + } + if ($type == 5 && strlen($str) >= 2) { + if (!preg_match('/\d+/', $str) || !preg_match('/[A-Z]+/', $str)) { + $str = substr($str, 0, -1); + $i = $i - 1; + } + } + if ($type == 6 && strlen($str) >= 2) { + if (!preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) { + $str = substr($str, 0, -1); + $i = $i - 1; + } + } + if ($type == 7 && strlen($str) >= 3) { + if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) { + $str = substr($str, 0, -2); + $i = $i - 2; + } + } + } + return $str; + } +} diff --git a/src/Str.php b/src/Str.php new file mode 100644 index 0000000000000000000000000000000000000000..c745f7cd4a9da703ebca8973dcaf2cf33fd64998 --- /dev/null +++ b/src/Str.php @@ -0,0 +1,158 @@ +', '', $str); + $str = str_replace('《', '', $str); + $str = str_replace('》', '', $str); + $str = str_replace('.', '', $str); + $str = str_replace('。', '', $str); + $str = str_replace('/', '', $str); + $str = str_replace('、', '', $str); + $str = str_replace('?', '', $str); + $str = str_replace('?', '', $str); + $str = str_replace('╮', '', $str); + $str = str_replace('(', '', $str); + $str = str_replace(')', '', $str); + $str = str_replace('r', '', $str); + $str = str_replace('ぷ', '', $str); + $str = str_replace('〆', '', $str); + $str = str_replace('ゞ', '', $str); + $str = str_replace('ヤ', '', $str); + $str = str_replace('ゼ', '', $str); + $str = str_replace('ǎ', '', $str); + $str = str_replace('ǎ', '', $str); + $str = str_replace('〆', '', $str); + $str = str_replace('む', '', $str); + $str = str_replace('§', '', $str); + $str = str_replace('上门', '', $str); + return trim($str); + } + + /** + * 判断字符串是否包含某个字符 + * @param $str + * @param int $nee + * @param string $del + * @return bool + */ + public function exitContain(string $str, $nee = 3, $del = ',') + { + if (strpos($str, $del) !== false) { + $var = explode($del, $str); + foreach ($var as $v) { + if ($v == $nee) return true; + } + return false; + } else { + if ($str == $nee) return true; + return false; + } + } + + /** + * 统计字符串长度 + * @param string $str 字符串 + * @return int + */ + public function len(string $str) + { + return strlen($str); + } +} diff --git a/src/facade/Random.php b/src/facade/Random.php new file mode 100644 index 0000000000000000000000000000000000000000..cc7ad04a6fe721a8dfd70c185bb7079f2ad7c699 --- /dev/null +++ b/src/facade/Random.php @@ -0,0 +1,42 @@ +