Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

params.nativeTool #1

Open
chenxingmoonset opened this issue Apr 19, 2024 · 0 comments
Open

params.nativeTool #1

chenxingmoonset opened this issue Apr 19, 2024 · 0 comments

Comments

@chenxingmoonset
Copy link
Owner

chenxingmoonset commented Apr 19, 2024

香色闺阁原生能力支持使用params.nativeTool,有以下几个功能:

log(obj); // 打印log,key使用时间截
logWithKey(obj, strKey); // 打印log并自定义key

stringByObject(obj); // 将任意对象转换为字符串

deviceId(); // 默认的本地设备id,32位md5小写
deviceIdWithTemplateWithSeparator(strTemplate, strSeparator); // 自定义格式的本地设备id,strTemplate为模版,aaa-aa-aaaa,这里使用-分为3段,每段第一个字符将标识该段类型:0为纯数字,a为纯字母小写,A为纯字母大写,b为字符(数字+字母)小写,B为字符(数字+字母)大写,默认的deviceId模版即为:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

base64Decode(str); // base64解码,返回字符串
base64Encode(str); // base64编码,返回字符串
base64EncodeWithData(data); // 对二进制流(NSData)base64编码,返回字符串

readFile(strPath); // 从path中读取文件,返回二进制流
readTxtFile(strPath); // 从path中读取文件,返回字符串
unzipFile(strPath); // 解压zip文件,返回目录path
unzipFileWithPassword(strPath, strPassword); // 使用密码解压zip文件,返回目录path
allFilesAtPath(strDirPath); // 获取path目录下所有的文件path,返回数组:arr(path)

getCache(strKey); // 获取全局缓存对象
setCache(strKey, obj); // 设置全局缓存对象

sha1Encode(str); // 返回sha1
md5Encode(str); // 返回md5

cookieByKey(str); // 返回字符串
cookiesByUrl(url); // 返回数组

XPathParserWithSource(str); // 创建XPath解析器,可用于下面XPath解析器专用接口

XPath解析器接口有:
raw(); // 返回原始html
content(); // 返回内容
tagName(); // 返回字符串
attributes(); // 返回字典
queryWithXPath(strXPath); // 返回查询结果,以数组保存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant