如题商品调用出来后,标题的字符长度怎么控制?有哪位高手能帮我解决吗? 小弟在此感谢了. &length=30 //30表示30个字节 <!--{tag("moduleid=5&length=36&condition=status=3 and level>0 and thumb<>''&areaid=$cityid&pagesize=".$DT['page_sell']."&order=addtime de
// 获取字符串的字节长度 function len(s) { s = String(s); return s.length + (s.match(/[^\x00-\xff]/g) || "").length;// 加上匹配到的全角字符长度 } function limit(obj, limit) { var val = obj.value; if (len(val) > limit) { val=val.substring(0,limit); while (len(val) &
请看以下代码 1 private static int GetStrLength(string str) 2 { 3 if (string.IsNullOrEmpty(str)) return 0; 4 ASCIIEncoding ascii = new ASCIIEncoding(); 5 int tempLen = 0; 6 byte[] s = ascii.GetBytes(str); 7 for (int i = 0; i < s.Length; i++) 8 { 9 if ((int)