- 浏览: 1318248 次
- 性别:
- 来自: 江苏
-
最新评论
-
honey_fansy:
的确,不要自己的支持就说完美支持,我的就不行,别说我的不是fi ...
无js实现text-overflow: ellipsis; 完美支持Firefox -
fanchengfei:
事件长微博,欢迎转发:http://weibo.com/332 ...
《在路上 …》 写代码也需要一点演技 – python2.6 的 class decorator -
blued:
没有报错,但排版效果一点都没有 咋回事。请指教
python排版工具 -
szxiaoli:
耍人呀,效果在哪儿呀
滑动效果 -
accaolei:
这个能监到控子目录吗?,我测试了一下,发现子目录里的文件监控不 ...
windows监控目录改动
先问一个问题,现在cpu浮点数的计算并不比整数慢?是吗?
——————————————————
linux下我用python+jquery测试出了字符串宽度的参数
明天到win下测试
附带测试源代码
___________________________
python对ascii用ord(i)-32
visable_width=0.5333333333333333,0.8,1,1.6,1.6,2.6,2,0.6,1,1,1.2,1.8,0.8,1,0.8,0.8,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,0.8,0.8,1.8,1.8,1.8,1.6,3,2,2,2.2,2.2,2,1.8,2.2,2.2,0.8,1.4,2,1.6,2.4,2.2,2.2,2,2.2,2.2,2,1.8,2.2,2,2.8,2,2,1.8,0.8,0.8,0.8,1.4,1.6,1,1.6,1.6,1.4,1.6,1.6,0.8,1.6,1.6,0.6,0.6,1.4,0.6,2.4,1.6,1.6,1.6,1.6,1,1.4,0.8,1.6,1.4,2.2,1.4,1.4,1.4,1,0.8,1,1.8
测试基准 一 : 1
unichr(32) => : 0.5333333333333333
unichr(33) => ! : 0.8
unichr(34) => " : 1
unichr(35) => # : 1.6
unichr(36) => $ : 1.6
unichr(37) => % : 2.6
unichr(38) => & : 2
unichr(39) => ' : 0.6
unichr(40) => ( : 1
unichr(41) => ) : 1
unichr(42) => * : 1.2
unichr(43) => + : 1.8
unichr(44) => , : 0.8
unichr(45) => - : 1
unichr(46) => . : 0.8
unichr(47) => / : 0.8
unichr(48) => 0 : 1.6
unichr(49) => 1 : 1.6
unichr(50) => 2 : 1.6
unichr(51) => 3 : 1.6
unichr(52) => 4 : 1.6
unichr(53) => 5 : 1.6
unichr(54) => 6 : 1.6
unichr(55) => 7 : 1.6
unichr(56) => 8 : 1.6
unichr(57) => 9 : 1.6
unichr(58) => : : 0.8
unichr(59) => ; : 0.8
unichr(60) => < : 1.8
unichr(61) => = : 1.8
unichr(62) => > : 1.8
unichr(63) => ? : 1.6
unichr(64) => @ : 3
unichr(65) => A : 2
unichr(66) => B : 2
unichr(67) => C : 2.2
unichr(68) => D : 2.2
unichr(69) => E : 2
unichr(70) => F : 1.8
unichr(71) => G : 2.2
unichr(72) => H : 2.2
unichr(73) => I : 0.8
unichr(74) => J : 1.4
unichr(75) => K : 2
unichr(76) => L : 1.6
unichr(77) => M : 2.4
unichr(78) => N : 2.2
unichr(79) => O : 2.2
unichr(80) => P : 2
unichr(81) => Q : 2.2
unichr(82) => R : 2.2
unichr(83) => S : 2
unichr(84) => T : 1.8
unichr(85) => U : 2.2
unichr(86) => V : 2
unichr(87) => W : 2.8
unichr(88) => X : 2
unichr(89) => Y : 2
unichr(90) => Z : 1.8
unichr(91) => [ : 0.8
unichr(92) => \ : 0.8
unichr(93) => ] : 0.8
unichr(94) => ^ : 1.4
unichr(95) => _ : 1.6
unichr(96) => ` : 1
unichr(97) => a : 1.6
unichr(98) => b : 1.6
unichr(99) => c : 1.4
unichr(100) => d : 1.6
unichr(101) => e : 1.6
unichr(102) => f : 0.8
unichr(103) => g : 1.6
unichr(104) => h : 1.6
unichr(105) => i : 0.6
unichr(106) => j : 0.6
unichr(107) => k : 1.4
unichr(108) => l : 0.6
unichr(109) => m : 2.4
unichr(110) => n : 1.6
unichr(111) => o : 1.6
unichr(112) => p : 1.6
unichr(113) => q : 1.6
unichr(114) => r : 1
unichr(115) => s : 1.4
unichr(116) => t : 0.8
unichr(117) => u : 1.6
unichr(118) => v : 1.4
unichr(119) => w : 2.2
unichr(120) => x : 1.4
unichr(121) => y : 1.4
unichr(122) => z : 1.4
unichr(123) => { : 1
unichr(124) => | : 0.8
unichr(125) => } : 1
unichr(126) => ~ : 1.8
一二三四五六七八九十
165px
88px
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
132px
""""""""""""""""""""""""""""""
165px
##############################
264px
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
264px
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429px
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
330px
''''''''''''''''''''''''''''''
99px
((((((((((((((((((((((((((((((
165px
))))))))))))))))))))))))))))))
165px
******************************
198px
++++++++++++++++++++++++++++++
297px
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
132px
------------------------------
165px
..............................
132px
//////////////////////////////
132px
000000000000000000000000000000
264px
111111111111111111111111111111
264px
222222222222222222222222222222
264px
333333333333333333333333333333
264px
444444444444444444444444444444
264px
555555555555555555555555555555
264px
666666666666666666666666666666
264px
777777777777777777777777777777
264px
888888888888888888888888888888
264px
999999999999999999999999999999
264px
::::::::::::::::::::::::::::::
132px
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132px
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
297px
==============================
297px
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
297px
??????????????????????????????
264px
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
495px
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
330px
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
330px
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
363px
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
363px
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
330px
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
297px
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
363px
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
363px
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
132px
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
231px
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
330px
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
264px
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
396px
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
363px
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
363px
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
330px
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
363px
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
363px
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
330px
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
297px
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
363px
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
330px
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
462px
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
330px
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
330px
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
297px
[[[[[[[[[[[[[[[
132px
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
132px
]]]]]]]]]]]]]]]
132px
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
231px
______________________________
264px
``````````````````````````````
165px
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
264px
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
264px
cccccccccccccccccccccccccccccc
231px
dddddddddddddddddddddddddddddd
264px
eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
264px
ffffffffffffffffffffffffffffff
132px
gggggggggggggggggggggggggggggg
264px
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
264px
iiiiiiiiiiiiiiiiiiiiiiiiiiiiii
99px
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
99px
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
231px
llllllllllllllllllllllllllllll
99px
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
396px
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
264px
oooooooooooooooooooooooooooooo
264px
pppppppppppppppppppppppppppppp
264px
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
264px
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
165px
ssssssssssssssssssssssssssssss
231px
tttttttttttttttttttttttttttttt
132px
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
264px
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
231px
wwwwwwwwwwwwwwwwwwwwwwwwwwwwww
363px
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
231px
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
231px
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
231px
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
165px
||||||||||||||||||||||||||||||
132px
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
165px
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297px
—————————————————
测试源代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.char_width_wrapper{margin:.5em 1em;float:left;clear:left;}
.char_width{background:#f2f2f2;font-family:Arial,Helvetica,sans-serif;}
</style>
<script src="jquery_src.js"></script>
<script>
$(function(){
var buf=[],base_width,python=[];
$(".char_width").each(function(i){
var rev_width,width=this.offsetWidth;
$(this.parentNode).append("<div>"+width+"px</div>")
if(buf.length){
rev_width=width/base_width;
i="unichr("+(i+31)+") =>";
python.push(rev_width)
}
else{
i="测试基准"
rev_width=1;
base_width=width;
}
buf.push(i+" "+$(this).text().substring(0,1)+" : "+rev_width)
})
$("#result").html(buf.join("<br/>"))
$("#python").html("visable_width="+python.join(","))
})
</script>
</head><body>
<div>python对ascii用ord(i)-32</div>
<p id="python"></p>
<p id="result"></p>
<div class="char_width_wrapper"><div class="char_width">一二三四五六七八九十</div></div>
<div class="char_width_wrapper"><div class="char_width"> </div></div>
<div class="char_width_wrapper"><div class="char_width">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</div></div>
<div class="char_width_wrapper"><div class="char_width">""""""""""""""""""""""""""""""</div></div>
<div class="char_width_wrapper"><div class="char_width">##############################</div></div>
<div class="char_width_wrapper"><div class="char_width">$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$</div></div>
<div class="char_width_wrapper"><div class="char_width">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</div></div>
<div class="char_width_wrapper"><div class="char_width">&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&</div></div>
<div class="char_width_wrapper"><div class="char_width">''''''''''''''''''''''''''''''</div></div>
<div class="char_width_wrapper"><div class="char_width">((((((((((((((((((((((((((((((</div></div>
<div class="char_width_wrapper"><div class="char_width">))))))))))))))))))))))))))))))</div></div>
<div class="char_width_wrapper"><div class="char_width">******************************</div></div>
<div class="char_width_wrapper"><div class="char_width">++++++++++++++++++++++++++++++</div></div>
<div class="char_width_wrapper"><div class="char_width">,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,</div></div>
<div class="char_width_wrapper"><div class="char_width">------------------------------</div></div>
<div class="char_width_wrapper"><div class="char_width">..............................</div></div>
<div class="char_width_wrapper"><div class="char_width">//////////////////////////////</div></div>
<div class="char_width_wrapper"><div class="char_width">000000000000000000000000000000</div></div>
<div class="char_width_wrapper"><div class="char_width">111111111111111111111111111111</div></div>
<div class="char_width_wrapper"><div class="char_width">222222222222222222222222222222</div></div>
<div class="char_width_wrapper"><div class="char_width">333333333333333333333333333333</div></div>
<div class="char_width_wrapper"><div class="char_width">444444444444444444444444444444</div></div>
<div class="char_width_wrapper"><div class="char_width">555555555555555555555555555555</div></div>
<div class="char_width_wrapper"><div class="char_width">666666666666666666666666666666</div></div>
<div class="char_width_wrapper"><div class="char_width">777777777777777777777777777777</div></div>
<div class="char_width_wrapper"><div class="char_width">888888888888888888888888888888</div></div>
<div class="char_width_wrapper"><div class="char_width">999999999999999999999999999999</div></div>
<div class="char_width_wrapper"><div class="char_width">::::::::::::::::::::::::::::::</div></div>
<div class="char_width_wrapper"><div class="char_width">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div></div>
<div class="char_width_wrapper"><div class="char_width"><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</div></div>
<div class="char_width_wrapper"><div class="char_width">==============================</div></div>
<div class="char_width_wrapper"><div class="char_width">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></div></div>
<div class="char_width_wrapper"><div class="char_width">??????????????????????????????</div></div>
<div class="char_width_wrapper"><div class="char_width">@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@</div></div>
<div class="char_width_wrapper"><div class="char_width">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</div></div>
<div class="char_width_wrapper"><div class="char_width">BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</div></div>
<div class="char_width_wrapper"><div class="char_width">CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</div></div>
<div class="char_width_wrapper"><div class="char_width">DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</div></div>
<div class="char_width_wrapper"><div class="char_width">EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE</div></div>
<div class="char_width_wrapper"><div class="char_width">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</div></div>
<div class="char_width_wrapper"><div class="char_width">GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG</div></div>
<div class="char_width_wrapper"><div class="char_width">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</div></div>
<div class="char_width_wrapper"><div class="char_width">IIIIIIIIIIIIIIIIIIIIIIIIIIIIII</div></div>
<div class="char_width_wrapper"><div class="char_width">JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ</div></div>
<div class="char_width_wrapper"><div class="char_width">KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK</div></div>
<div class="char_width_wrapper"><div class="char_width">LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL</div></div>
<div class="char_width_wrapper"><div class="char_width">MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM</div></div>
<div class="char_width_wrapper"><div class="char_width">NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN</div></div>
<div class="char_width_wrapper"><div class="char_width">OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</div></div>
<div class="char_width_wrapper"><div class="char_width">PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP</div></div>
<div class="char_width_wrapper"><div class="char_width">QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ</div></div>
<div class="char_width_wrapper"><div class="char_width">RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR</div></div>
<div class="char_width_wrapper"><div class="char_width">SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS</div></div>
<div class="char_width_wrapper"><div class="char_width">TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT</div></div>
<div class="char_width_wrapper"><div class="char_width">UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU</div></div>
<div class="char_width_wrapper"><div class="char_width">VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</div></div>
<div class="char_width_wrapper"><div class="char_width">WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW</div></div>
<div class="char_width_wrapper"><div class="char_width">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</div></div>
<div class="char_width_wrapper"><div class="char_width">YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</div></div>
<div class="char_width_wrapper"><div class="char_width">ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</div></div>
<div class="char_width_wrapper"><div class="char_width">[[[[[[[[[[[[[[[</div></div>
<div class="char_width_wrapper"><div class="char_width">\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</div></div>
<div class="char_width_wrapper"><div class="char_width">]]]]]]]]]]]]]]]</div></div>
<div class="char_width_wrapper"><div class="char_width">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</div></div>
<div class="char_width_wrapper"><div class="char_width">______________________________</div></div>
<div class="char_width_wrapper"><div class="char_width">``````````````````````````````</div></div>
<div class="char_width_wrapper"><div class="char_width">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div></div>
<div class="char_width_wrapper"><div class="char_width">bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</div></div>
<div class="char_width_wrapper"><div class="char_width">cccccccccccccccccccccccccccccc</div></div>
<div class="char_width_wrapper"><div class="char_width">dddddddddddddddddddddddddddddd</div></div>
<div class="char_width_wrapper"><div class="char_width">eeeeeeeeeeeeeeeeeeeeeeeeeeeeee</div></div>
<div class="char_width_wrapper"><div class="char_width">ffffffffffffffffffffffffffffff</div></div>
<div class="char_width_wrapper"><div class="char_width">gggggggggggggggggggggggggggggg</div></div>
<div class="char_width_wrapper"><div class="char_width">hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh</div></div>
<div class="char_width_wrapper"><div class="char_width">iiiiiiiiiiiiiiiiiiiiiiiiiiiiii</div></div>
<div class="char_width_wrapper"><div class="char_width">jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj</div></div>
<div class="char_width_wrapper"><div class="char_width">kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk</div></div>
<div class="char_width_wrapper"><div class="char_width">llllllllllllllllllllllllllllll</div></div>
<div class="char_width_wrapper"><div class="char_width">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</div></div>
<div class="char_width_wrapper"><div class="char_width">nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn</div></div>
<div class="char_width_wrapper"><div class="char_width">oooooooooooooooooooooooooooooo</div></div>
<div class="char_width_wrapper"><div class="char_width">pppppppppppppppppppppppppppppp</div></div>
<div class="char_width_wrapper"><div class="char_width">qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</div></div>
<div class="char_width_wrapper"><div class="char_width">rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr</div></div>
<div class="char_width_wrapper"><div class="char_width">ssssssssssssssssssssssssssssss</div></div>
<div class="char_width_wrapper"><div class="char_width">tttttttttttttttttttttttttttttt</div></div>
<div class="char_width_wrapper"><div class="char_width">uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu</div></div>
<div class="char_width_wrapper"><div class="char_width">vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv</div></div>
<div class="char_width_wrapper"><div class="char_width">wwwwwwwwwwwwwwwwwwwwwwwwwwwwww</div></div>
<div class="char_width_wrapper"><div class="char_width">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div></div>
<div class="char_width_wrapper"><div class="char_width">yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy</div></div>
<div class="char_width_wrapper"><div class="char_width">zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</div></div>
<div class="char_width_wrapper"><div class="char_width">{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{</div></div>
<div class="char_width_wrapper"><div class="char_width">||||||||||||||||||||||||||||||</div></div>
<div class="char_width_wrapper"><div class="char_width">}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</div></div>
<div class="char_width_wrapper"><div class="char_width">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div></div>
</body></html>
____________________________________________________
python截断函数-未完成
def utf8_cut(word,limit,etc="..."):
"""一个中文当2个E文"""
cn=0
en=0
i=0
length=len(word)
if length<=limit:return word
limit = limit<<1
width=0
while i<length:
c=word[i]
if c>"\xE0" and c<="\xEF":
offset=3
width+=2
else:
if c<"\xC0":
offset=1
width+=1
else:
width+=2
if c<="\xDF":offset=2
elif c<="\xF7":offset=4
elif c<="\xFB":offset=5
else:offset=6
if width>limit:
return word[:i]+etc
else:
i+=offset
return word
——————————————————
linux下我用python+jquery测试出了字符串宽度的参数
明天到win下测试
附带测试源代码
___________________________
python对ascii用ord(i)-32
visable_width=0.5333333333333333,0.8,1,1.6,1.6,2.6,2,0.6,1,1,1.2,1.8,0.8,1,0.8,0.8,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,1.6,0.8,0.8,1.8,1.8,1.8,1.6,3,2,2,2.2,2.2,2,1.8,2.2,2.2,0.8,1.4,2,1.6,2.4,2.2,2.2,2,2.2,2.2,2,1.8,2.2,2,2.8,2,2,1.8,0.8,0.8,0.8,1.4,1.6,1,1.6,1.6,1.4,1.6,1.6,0.8,1.6,1.6,0.6,0.6,1.4,0.6,2.4,1.6,1.6,1.6,1.6,1,1.4,0.8,1.6,1.4,2.2,1.4,1.4,1.4,1,0.8,1,1.8
测试基准 一 : 1
unichr(32) => : 0.5333333333333333
unichr(33) => ! : 0.8
unichr(34) => " : 1
unichr(35) => # : 1.6
unichr(36) => $ : 1.6
unichr(37) => % : 2.6
unichr(38) => & : 2
unichr(39) => ' : 0.6
unichr(40) => ( : 1
unichr(41) => ) : 1
unichr(42) => * : 1.2
unichr(43) => + : 1.8
unichr(44) => , : 0.8
unichr(45) => - : 1
unichr(46) => . : 0.8
unichr(47) => / : 0.8
unichr(48) => 0 : 1.6
unichr(49) => 1 : 1.6
unichr(50) => 2 : 1.6
unichr(51) => 3 : 1.6
unichr(52) => 4 : 1.6
unichr(53) => 5 : 1.6
unichr(54) => 6 : 1.6
unichr(55) => 7 : 1.6
unichr(56) => 8 : 1.6
unichr(57) => 9 : 1.6
unichr(58) => : : 0.8
unichr(59) => ; : 0.8
unichr(60) => < : 1.8
unichr(61) => = : 1.8
unichr(62) => > : 1.8
unichr(63) => ? : 1.6
unichr(64) => @ : 3
unichr(65) => A : 2
unichr(66) => B : 2
unichr(67) => C : 2.2
unichr(68) => D : 2.2
unichr(69) => E : 2
unichr(70) => F : 1.8
unichr(71) => G : 2.2
unichr(72) => H : 2.2
unichr(73) => I : 0.8
unichr(74) => J : 1.4
unichr(75) => K : 2
unichr(76) => L : 1.6
unichr(77) => M : 2.4
unichr(78) => N : 2.2
unichr(79) => O : 2.2
unichr(80) => P : 2
unichr(81) => Q : 2.2
unichr(82) => R : 2.2
unichr(83) => S : 2
unichr(84) => T : 1.8
unichr(85) => U : 2.2
unichr(86) => V : 2
unichr(87) => W : 2.8
unichr(88) => X : 2
unichr(89) => Y : 2
unichr(90) => Z : 1.8
unichr(91) => [ : 0.8
unichr(92) => \ : 0.8
unichr(93) => ] : 0.8
unichr(94) => ^ : 1.4
unichr(95) => _ : 1.6
unichr(96) => ` : 1
unichr(97) => a : 1.6
unichr(98) => b : 1.6
unichr(99) => c : 1.4
unichr(100) => d : 1.6
unichr(101) => e : 1.6
unichr(102) => f : 0.8
unichr(103) => g : 1.6
unichr(104) => h : 1.6
unichr(105) => i : 0.6
unichr(106) => j : 0.6
unichr(107) => k : 1.4
unichr(108) => l : 0.6
unichr(109) => m : 2.4
unichr(110) => n : 1.6
unichr(111) => o : 1.6
unichr(112) => p : 1.6
unichr(113) => q : 1.6
unichr(114) => r : 1
unichr(115) => s : 1.4
unichr(116) => t : 0.8
unichr(117) => u : 1.6
unichr(118) => v : 1.4
unichr(119) => w : 2.2
unichr(120) => x : 1.4
unichr(121) => y : 1.4
unichr(122) => z : 1.4
unichr(123) => { : 1
unichr(124) => | : 0.8
unichr(125) => } : 1
unichr(126) => ~ : 1.8
一二三四五六七八九十
165px
88px
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
132px
""""""""""""""""""""""""""""""
165px
##############################
264px
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
264px
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429px
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
330px
''''''''''''''''''''''''''''''
99px
((((((((((((((((((((((((((((((
165px
))))))))))))))))))))))))))))))
165px
******************************
198px
++++++++++++++++++++++++++++++
297px
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
132px
------------------------------
165px
..............................
132px
//////////////////////////////
132px
000000000000000000000000000000
264px
111111111111111111111111111111
264px
222222222222222222222222222222
264px
333333333333333333333333333333
264px
444444444444444444444444444444
264px
555555555555555555555555555555
264px
666666666666666666666666666666
264px
777777777777777777777777777777
264px
888888888888888888888888888888
264px
999999999999999999999999999999
264px
::::::::::::::::::::::::::::::
132px
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132px
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
297px
==============================
297px
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
297px
??????????????????????????????
264px
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
495px
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
330px
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
330px
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
363px
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
363px
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
330px
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
297px
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
363px
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
363px
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII
132px
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
231px
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
330px
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
264px
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
396px
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
363px
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
363px
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
330px
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
363px
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
363px
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
330px
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
297px
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
363px
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
330px
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
462px
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
330px
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
330px
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
297px
[[[[[[[[[[[[[[[
132px
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
132px
]]]]]]]]]]]]]]]
132px
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
231px
______________________________
264px
``````````````````````````````
165px
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
264px
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
264px
cccccccccccccccccccccccccccccc
231px
dddddddddddddddddddddddddddddd
264px
eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
264px
ffffffffffffffffffffffffffffff
132px
gggggggggggggggggggggggggggggg
264px
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
264px
iiiiiiiiiiiiiiiiiiiiiiiiiiiiii
99px
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
99px
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
231px
llllllllllllllllllllllllllllll
99px
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
396px
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
264px
oooooooooooooooooooooooooooooo
264px
pppppppppppppppppppppppppppppp
264px
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
264px
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
165px
ssssssssssssssssssssssssssssss
231px
tttttttttttttttttttttttttttttt
132px
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
264px
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
231px
wwwwwwwwwwwwwwwwwwwwwwwwwwwwww
363px
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
231px
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
231px
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
231px
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
165px
||||||||||||||||||||||||||||||
132px
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
165px
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297px
—————————————————
测试源代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.char_width_wrapper{margin:.5em 1em;float:left;clear:left;}
.char_width{background:#f2f2f2;font-family:Arial,Helvetica,sans-serif;}
</style>
<script src="jquery_src.js"></script>
<script>
$(function(){
var buf=[],base_width,python=[];
$(".char_width").each(function(i){
var rev_width,width=this.offsetWidth;
$(this.parentNode).append("<div>"+width+"px</div>")
if(buf.length){
rev_width=width/base_width;
i="unichr("+(i+31)+") =>";
python.push(rev_width)
}
else{
i="测试基准"
rev_width=1;
base_width=width;
}
buf.push(i+" "+$(this).text().substring(0,1)+" : "+rev_width)
})
$("#result").html(buf.join("<br/>"))
$("#python").html("visable_width="+python.join(","))
})
</script>
</head><body>
<div>python对ascii用ord(i)-32</div>
<p id="python"></p>
<p id="result"></p>
<div class="char_width_wrapper"><div class="char_width">一二三四五六七八九十</div></div>
<div class="char_width_wrapper"><div class="char_width"> </div></div>
<div class="char_width_wrapper"><div class="char_width">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</div></div>
<div class="char_width_wrapper"><div class="char_width">""""""""""""""""""""""""""""""</div></div>
<div class="char_width_wrapper"><div class="char_width">##############################</div></div>
<div class="char_width_wrapper"><div class="char_width">$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$</div></div>
<div class="char_width_wrapper"><div class="char_width">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</div></div>
<div class="char_width_wrapper"><div class="char_width">&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&</div></div>
<div class="char_width_wrapper"><div class="char_width">''''''''''''''''''''''''''''''</div></div>
<div class="char_width_wrapper"><div class="char_width">((((((((((((((((((((((((((((((</div></div>
<div class="char_width_wrapper"><div class="char_width">))))))))))))))))))))))))))))))</div></div>
<div class="char_width_wrapper"><div class="char_width">******************************</div></div>
<div class="char_width_wrapper"><div class="char_width">++++++++++++++++++++++++++++++</div></div>
<div class="char_width_wrapper"><div class="char_width">,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,</div></div>
<div class="char_width_wrapper"><div class="char_width">------------------------------</div></div>
<div class="char_width_wrapper"><div class="char_width">..............................</div></div>
<div class="char_width_wrapper"><div class="char_width">//////////////////////////////</div></div>
<div class="char_width_wrapper"><div class="char_width">000000000000000000000000000000</div></div>
<div class="char_width_wrapper"><div class="char_width">111111111111111111111111111111</div></div>
<div class="char_width_wrapper"><div class="char_width">222222222222222222222222222222</div></div>
<div class="char_width_wrapper"><div class="char_width">333333333333333333333333333333</div></div>
<div class="char_width_wrapper"><div class="char_width">444444444444444444444444444444</div></div>
<div class="char_width_wrapper"><div class="char_width">555555555555555555555555555555</div></div>
<div class="char_width_wrapper"><div class="char_width">666666666666666666666666666666</div></div>
<div class="char_width_wrapper"><div class="char_width">777777777777777777777777777777</div></div>
<div class="char_width_wrapper"><div class="char_width">888888888888888888888888888888</div></div>
<div class="char_width_wrapper"><div class="char_width">999999999999999999999999999999</div></div>
<div class="char_width_wrapper"><div class="char_width">::::::::::::::::::::::::::::::</div></div>
<div class="char_width_wrapper"><div class="char_width">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div></div>
<div class="char_width_wrapper"><div class="char_width"><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</div></div>
<div class="char_width_wrapper"><div class="char_width">==============================</div></div>
<div class="char_width_wrapper"><div class="char_width">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></div></div>
<div class="char_width_wrapper"><div class="char_width">??????????????????????????????</div></div>
<div class="char_width_wrapper"><div class="char_width">@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@</div></div>
<div class="char_width_wrapper"><div class="char_width">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</div></div>
<div class="char_width_wrapper"><div class="char_width">BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</div></div>
<div class="char_width_wrapper"><div class="char_width">CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</div></div>
<div class="char_width_wrapper"><div class="char_width">DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</div></div>
<div class="char_width_wrapper"><div class="char_width">EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE</div></div>
<div class="char_width_wrapper"><div class="char_width">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</div></div>
<div class="char_width_wrapper"><div class="char_width">GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG</div></div>
<div class="char_width_wrapper"><div class="char_width">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</div></div>
<div class="char_width_wrapper"><div class="char_width">IIIIIIIIIIIIIIIIIIIIIIIIIIIIII</div></div>
<div class="char_width_wrapper"><div class="char_width">JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ</div></div>
<div class="char_width_wrapper"><div class="char_width">KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK</div></div>
<div class="char_width_wrapper"><div class="char_width">LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL</div></div>
<div class="char_width_wrapper"><div class="char_width">MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM</div></div>
<div class="char_width_wrapper"><div class="char_width">NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN</div></div>
<div class="char_width_wrapper"><div class="char_width">OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</div></div>
<div class="char_width_wrapper"><div class="char_width">PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP</div></div>
<div class="char_width_wrapper"><div class="char_width">QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ</div></div>
<div class="char_width_wrapper"><div class="char_width">RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR</div></div>
<div class="char_width_wrapper"><div class="char_width">SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS</div></div>
<div class="char_width_wrapper"><div class="char_width">TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT</div></div>
<div class="char_width_wrapper"><div class="char_width">UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU</div></div>
<div class="char_width_wrapper"><div class="char_width">VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</div></div>
<div class="char_width_wrapper"><div class="char_width">WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW</div></div>
<div class="char_width_wrapper"><div class="char_width">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</div></div>
<div class="char_width_wrapper"><div class="char_width">YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY</div></div>
<div class="char_width_wrapper"><div class="char_width">ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</div></div>
<div class="char_width_wrapper"><div class="char_width">[[[[[[[[[[[[[[[</div></div>
<div class="char_width_wrapper"><div class="char_width">\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</div></div>
<div class="char_width_wrapper"><div class="char_width">]]]]]]]]]]]]]]]</div></div>
<div class="char_width_wrapper"><div class="char_width">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</div></div>
<div class="char_width_wrapper"><div class="char_width">______________________________</div></div>
<div class="char_width_wrapper"><div class="char_width">``````````````````````````````</div></div>
<div class="char_width_wrapper"><div class="char_width">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div></div>
<div class="char_width_wrapper"><div class="char_width">bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</div></div>
<div class="char_width_wrapper"><div class="char_width">cccccccccccccccccccccccccccccc</div></div>
<div class="char_width_wrapper"><div class="char_width">dddddddddddddddddddddddddddddd</div></div>
<div class="char_width_wrapper"><div class="char_width">eeeeeeeeeeeeeeeeeeeeeeeeeeeeee</div></div>
<div class="char_width_wrapper"><div class="char_width">ffffffffffffffffffffffffffffff</div></div>
<div class="char_width_wrapper"><div class="char_width">gggggggggggggggggggggggggggggg</div></div>
<div class="char_width_wrapper"><div class="char_width">hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh</div></div>
<div class="char_width_wrapper"><div class="char_width">iiiiiiiiiiiiiiiiiiiiiiiiiiiiii</div></div>
<div class="char_width_wrapper"><div class="char_width">jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj</div></div>
<div class="char_width_wrapper"><div class="char_width">kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk</div></div>
<div class="char_width_wrapper"><div class="char_width">llllllllllllllllllllllllllllll</div></div>
<div class="char_width_wrapper"><div class="char_width">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</div></div>
<div class="char_width_wrapper"><div class="char_width">nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn</div></div>
<div class="char_width_wrapper"><div class="char_width">oooooooooooooooooooooooooooooo</div></div>
<div class="char_width_wrapper"><div class="char_width">pppppppppppppppppppppppppppppp</div></div>
<div class="char_width_wrapper"><div class="char_width">qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq</div></div>
<div class="char_width_wrapper"><div class="char_width">rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr</div></div>
<div class="char_width_wrapper"><div class="char_width">ssssssssssssssssssssssssssssss</div></div>
<div class="char_width_wrapper"><div class="char_width">tttttttttttttttttttttttttttttt</div></div>
<div class="char_width_wrapper"><div class="char_width">uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu</div></div>
<div class="char_width_wrapper"><div class="char_width">vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv</div></div>
<div class="char_width_wrapper"><div class="char_width">wwwwwwwwwwwwwwwwwwwwwwwwwwwwww</div></div>
<div class="char_width_wrapper"><div class="char_width">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div></div>
<div class="char_width_wrapper"><div class="char_width">yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy</div></div>
<div class="char_width_wrapper"><div class="char_width">zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</div></div>
<div class="char_width_wrapper"><div class="char_width">{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{</div></div>
<div class="char_width_wrapper"><div class="char_width">||||||||||||||||||||||||||||||</div></div>
<div class="char_width_wrapper"><div class="char_width">}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</div></div>
<div class="char_width_wrapper"><div class="char_width">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div></div>
</body></html>
____________________________________________________
python截断函数-未完成
def utf8_cut(word,limit,etc="..."):
"""一个中文当2个E文"""
cn=0
en=0
i=0
length=len(word)
if length<=limit:return word
limit = limit<<1
width=0
while i<length:
c=word[i]
if c>"\xE0" and c<="\xEF":
offset=3
width+=2
else:
if c<"\xC0":
offset=1
width+=1
else:
width+=2
if c<="\xDF":offset=2
elif c<="\xF7":offset=4
elif c<="\xFB":offset=5
else:offset=6
if width>limit:
return word[:i]+etc
else:
i+=offset
return word
评论
2 楼
zuroc
2008-11-17
这个用于正文截断,字体可以改一改测量的html,差不过就可以.不必要太精确.
标题截断可以参考
无js实现text-overflow: ellipsis; 完美支持Firefox
http://zsp.iteye.com/blog/261175
标题截断可以参考
无js实现text-overflow: ellipsis; 完美支持Firefox
http://zsp.iteye.com/blog/261175
1 楼
hax
2008-11-16
字体不同,当然结果就不同。
不同浏览器处理或许还会有差异。
IE上某些office扩展特性或许会引入额外的排版差异。
最保险的方法恐怕还是创建一个hidden的元素然后放入文本计算高宽。
不同浏览器处理或许还会有差异。
IE上某些office扩展特性或许会引入额外的排版差异。
最保险的方法恐怕还是创建一个hidden的元素然后放入文本计算高宽。
发表评论
-
gz后仅5.5K的Rich Editor
2009-12-24 14:31 2094http://kissy.googlecode.com/sv ... -
windows监控目录改动
2009-07-30 16:30 3385先安装 http://sourceforge.net/proj ... -
每天写一点web框架 5
2009-07-29 23:31 1605继续 http://blog.html.it/layoutg ... -
每天写一点web框架 4
2009-07-28 10:02 1381昨天有事出差,先补上一篇 先 easy_install we ... -
每天写一点web框架 3
2009-07-26 11:22 1369http://code.google.com/p/zpyweb ... -
每天写一点web框架 2
2009-07-25 21:37 1297今天把url route弄好了 http://code.goo ... -
每天写一点web框架 1
2009-07-24 17:32 1511打算开始写一个web框架了 有空就写一点吧 今天写的是模 ... -
linux 命令 zcat , pgrep
2009-07-15 01:43 4866http://www.ibm.com/developerwor ... -
Tokyo Dystopia 全文搜索
2009-07-13 10:33 2345http://d.hatena.ne.jp/perezvon/ ... -
随笔...
2009-05-21 01:00 12881. 交换机的东西我一点不懂 今晚学了一点. 100M 电 ... -
jquery.wysiwyg.js
2009-05-19 01:58 7367http://code.google.com/p/jwysiw ... -
linux下安装dns本地缓存
2009-04-12 12:04 4372linux的版本是gentoo 写爬虫不用dns缓存很容易就 ... -
事前审查系统设计思路整理
2009-03-18 18:17 1555整理一下思路 先定义一个函数 function 发表函数( ... -
顺手写的一个tab样式
2009-03-02 16:39 2315<!DOCTYPE HTML PUBLIC &quo ... -
备忘:MySQL InnoDB Error "the table is full"
2009-02-23 13:16 3669http://blog.imminentweb.com/te ... -
LucidDB 备忘
2009-02-21 00:04 3400http://en.wikipedia.org/wiki ... -
js高亮关键词代码备忘
2009-02-17 11:42 2605当然是抄的啊:) 管理后台用这个很方便 <!DOCTY ... -
google reader 的 prompt 函数
2009-01-27 11:40 1734IE7对prompt做了限制,MS的产品部门真是好奇怪... ... -
jquery 1.3 event模型(消息<->订阅者)
2009-01-21 17:18 14181.3中对event进行改版,现在$(xxx).click等等 ... -
js抄袭笔记 -- 飞出
2009-01-20 15:39 1407这个博客http://james.padolsey.com ...
相关推荐
NULL 博文链接:https://zsp.iteye.com/blog/267433
问题定位结果: 遇到&时,该参数的值会自动截断,导致参数值传递有误。 二、问题的解决 java代码中做如下测试: String charEncode = java.net.URLEncoder.encode(“&”); System.out.println(“字符& 转译后的值为...
在网页设计和开发过程中,精确地测量页面元素的尺寸至关重要,因为这直接影响到用户体验和页面的视觉一致性。这里我们讨论的是一款专为这个目的设计的工具,它具有伸缩功能,能够以像素为单位来测量页面长度,并且以...
在压缩包文件"截断切割的切割方式设计.PDF"中,很可能详细阐述了各种截断切割的技术和策略,包括但不限于动态截断、固定长度截断、基于阈值的截断等。这些方法可能会结合具体应用场景,如图像处理中的像素截断、时间...
该插件的核心在于其提供的过滤器,它可以接受几个参数,以便定制截断行为。例如,你可以指定截断的字符数、是否在截断处添加省略号以及是否根据单词边界进行截断。这些参数使得Angular Truncate非常灵活,能够适应...
数学建模97截断切割程序,用c语言编写的,能够求出切割的次数
截断通常是指去掉数据或文件的某一部分,比如超出指定长度的部分,以满足特定的需求,如数据库字段限制或网络传输的限制。而切割则是将一个大文件分解成多个小文件,便于管理、分发或存储,比如在上传大文件时为了...
该函数接受三个参数:原始字符串、开始位置和长度。例如,`substr($str, 0, 20)`会返回字符串的前20个字符。然而,这种方法不考虑字符串中的单词边界,可能会在单词中间截断。 2. **考虑单词边界的截断:**为了在...
如果可能,应该先清理或截断超出新长度的数据,或者调整业务逻辑以处理更长或更短的字符串。 在标签中提到的"压缩解压",暗示"AlterCol.exe"可能是一个独立的可执行文件,需要下载并解压才能使用。使用过程中可能...
以上就是在VC++中实现字符长度截断并省略显示的一些基本方法。在实际应用中,还需要考虑多线程安全、性能优化、兼容性等问题,以及可能需要结合具体的应用场景和用户需求进行调整。理解这些基础知识点将有助于你更好...
截断法线生成器Matlab代码则是将理论算法通过Matlab编程语言实现的工具,其核心作用是快速生成并处理三维模型表面的法线信息,特别是在那些表面特征不连续或者粗糙度变化较大的区域。 在Matlab中,生成截断法线生成...
例如,当使用`SqlCommand`执行SQL插入或更新语句时,如果参数值超过了对应列的长度,就会出现“将截断字符串或二进制数据”的错误。 3. 避免错误的方法: - 检查数据库设计:确保数据库表结构中字段的长度足够存储...
在本节课中,我们学习了文件上传-绕过白名单验证(00截断绕过)的原理和方法,包括00截断原理、GET型00截断、POST型00截断、一句话代码执行Webshell等。这些知识将帮助开发者更好地理解文件上传的安全风险,提高...
本文将针对上传的压缩包文件《使用块截断编码进行图像压缩Matlab代码》进行详细解读,内容涵盖代码的版本、适用范围、特点以及相关技术细节。 首先,关于版本信息,本压缩包内含的Matlab代码支持多个版本,分别是...
本文研究基于验证数据的非参数回归测量误差模型的估计方法。 估计程序基于正交序列估计和截断序列逼近方法,没有指定任何结构方程式和分布假设。 推导了所提出的估计量的收敛速度。 通过示例和仿真,该方法对测量...
在这个过程中,截断半径是一个关键的参数,它定义了粒子间作用力的计算范围,即只有在截断半径范围内的粒子间才考虑相互作用力,超出此范围的粒子则被忽略。 传统的分子动力学模拟常常采用一个固定的截断半径,但...
该错误代码表明源代码的长度参数无效。 MQRC_TARGET_BUFFER_ERROR (2146, X'862"):目标缓冲区参数无效。该错误代码表明目标缓冲区参数无效。 MQRC_TARGET_CCSID_ERROR (2115, X'843"):目标编码字符集标识无效。...
附带的两个截图文件`Screenshot_2018-09-13-14-45-13.png`和`Screenshot_2018-09-07-18-25-22.png`很可能是原始影像与执行百分比截断拉伸后的对比图,展示了拉伸操作如何改善了图像的视觉效果,使得地物的边缘和细节...