asp教程.net 10进制字符串转换为十六进制字符串
public string strtohex(string mstr) //返回处理后的十六进制字符串
{
return bitconverter.tostring(
asciiencoding.default.getbytes(mstr)).replace("-", " ");
} /* strtohex */
16进制字符串转换为10进制字符串
public string hextostr(string mhex) // 返回十六进制代表的字符串
{
mhex = mhex.replace(" ", "");
if (mhex.length <= 0) return "";
byte[] vbytes = new byte[mhex.length / 2];
for (int i = 0; i < mhex.length; i += 2)
if (!byte.tryparse(mhex.substring(i, 2), numberstyles.hexnumber, null, out vbytes[i / 2]))
vbytes[i / 2] = 0;
return asciiencoding.default.getstring(vbytes);
} /* hextostr */
字符串转换为宽字符
public static string stringtowchar(string s)
{
stringbuilder outs = new stringbuilder();
foreach (char item in s)
{
if (isencoding(item))//判断是否编码
{
outs.append(string.format("u{0:x4}", (int)item));
}
else//不是中文
{
outs.append(item);
}
}
return outs.tostring();
}
private static bool isencoding(char cha)
{
string nonencodingchats = "abcdefghijklmnopqrstuvwxyz0123456789`!@#$%^&*()_+|-=,./;'[]{}:<>?";
return nonencodingchats.indexof(cha) == -1;
}
DeepSeek多模态怎么样及保姆级配置教程(codex、claude)实用指南
WSL2+Docker+Ollama本地部署大模型思路和实践指南(Qwen1.8b)实用指南
DeepSeek Harness热门插件盘点:10个实用插件,覆盖多Agent、上下文和多模态实用指南
grep文本搜索与正则表达式完整代码示例实用指南
AI漫剧伪装直男1‑24集无雾版夸克网盘资源免费分享
AI漫剧玉僧入尘1-68集无雾无删版夸克网盘资源免费分享