|
沙发

楼主 |
发表于 2006-3-30 14:00:17
|
只看该作者
to maurice
好问题,看来你看PROG2的教材很仔细!
这是因为phonenumber=3125551212本来是数字型,现在被用在substr(phonenumber,1,3)里就自动转换成字符型。之前没有定义过长度,所以默认就是phonenumber的format的长度,phonenumber的默认format是BEST12.,所以就是12位,于是'3125551212'被填在12为的字符中,而且是规定是右对齐,这样就成了' 3125551212'。substr(phonenumber,1,3)自然就成了' 3'。
[code:375f8]code = '('!!substr(compress(phonenumber),1,3)!!')';[/code:375f8] |
|