📝 字符串处理接口

接口地址: /tools/stringtools/api.php
请求方式: GET / POST
必传参数: a=2

🔧 请求参数

参数说明
t / text待处理的字符串
type处理类型(见下表)
param额外参数(部分功能需要)

📋 type 参数列表 30+功能

基础操作

type说明param示例
length字符串长度-
reverse字符串反转-
uppercase转大写-
lowercase转小写-
trim去除首尾空格-
count统计信息-
oneline多行转一行-
removeBreaks删除换行和空格-

截取与替换

type说明param示例
substring截取字符串0,10
replace字符串替换old,new
repeat重复字符串3
rand_str生成随机字符串(长度为空默认32,前缀为空默认无)32,lx_

编码与加密

type说明param示例
md5MD5加密-
base64_encodeBase64编码-
base64_decodeBase64解码-
urlencodeURL编码-
urldecodeURL解码-
htmlspecialcharsHTML编码-
html_entity_decodeHTML解码-

填充

type说明param示例
pad_left左侧填充10,0
pad_right右侧填充10,0

判断检测

type说明param示例
contains是否包含hello
starts_with是否以...开头http://
ends_with是否以...结尾.jpg

提取清理

type说明param示例
remove_whitespace移除所有空白-
extract_numbers提取数字-
extract_chinese提取中文-
shuffle随机打乱-

格式转换

type说明param示例
camel_case转驼峰命名-
snake_case转下划线命名-
slugURL友好格式-

📌 调用示例

// GET请求
?t=HelloWorld&type=length
?t=HelloWorld&type=substring¶m=0,5
?t=123456&type=md5
?t=hello_world&type=camel_case

// POST请求 (JSON)
{
    "text": "Hello World",
    "type": "base64_encode"
}
💡 提示:必须携带 a=1 或 a=2 参数,例如:?a=1&t=hello&type=length