yanghefa - 2008-4-3 10:21:00
<script type="text/javascript" src="tools/showtopics.aspx?template=8&length=10&encoding=gb2312"></script>
为什么我把length 该成2 或改成 10效果都是一样的那,问一下什么原因

cyy1630 - 2008-4-3 12:42:00
Discuz!NT的字符串处理有点问题,最好自己重写一个
public static string CutString(string str, int length)
{
string temp = str;
int j = 0;
int k = 0;
for (int i = 0; i < temp.Length; i++)
{
if (Regex.IsMatch(temp.Substring(i, 1), @"[\u4e00-\u9fa5]+"))
{
j += 2;
}
else
{
j += 1;
}
if (j <= length)
{
k += 1;
}
if (j >= length)
{
return temp.Substring(0, k);
}
}
return temp;
}
yanghefa - 2008-4-3 13:32:00
我市在根目录建立的静态页面调用,又没有别的办法,<script type="text/javascript" src="tools/showtopics.aspx?template=8&length=10&encoding=gb2312"></script>不能用js 而showtopic中模板也不能修改,
买空间网14 - 2008-4-7 15:39:00
2楼的说的真详细哦!~~~不错 哦