OfficeÖйúÂÛ̳/AccessÖйúÂÛ̳

±êÌâ: Ϊʲôlenb("Ϊʲôlenb")=14¶ø²»µÈÓÚ10? [´òÓ¡±¾Ò³]

×÷Õß: Èýɽ¿Í    ʱ¼ä: 2006-5-21 06:25
±êÌâ: Ϊʲôlenb("Ϊʲôlenb")=14¶ø²»µÈÓÚ10?
Ϊʲôlenb("Ϊʲôlenb")=14¶ø²»µÈÓÚ10?
×÷Õß: LucasLynn    ʱ¼ä: 2006-5-21 06:43
ÒÔÏÂÊÇÒýÓÃÈýɽ¿ÍÔÚ2006-5-20 22:25:00µÄ·¢ÑÔ£º
Ϊʲôlenb("Ϊʲôlenb")=14¶ø²»µÈÓÚ10?





Unicodeʱ´úÁË¡£







×÷Õß: Èýɽ¿Í    ʱ¼ä: 2006-5-21 06:55
ÕæÊÇÉî°ÂµÄUnicode......
×÷Õß: andymark    ʱ¼ä: 2006-5-21 07:37
ÖÐÓ¢ÎÄ»ìºÏ,¿ÉÒÔÓÃÏÂÃæµÄ·½·¨»»Ëã

Dim Str As String

Str = "Ϊʲôlenb"
For i = 1 To Len(Str)

c = Asc(Mid(Str, i, 1))
If c >= 0 And c < 128 Then
   Len2 = Len2 + 1 '¼ÆËãÓ¢ÎÄ
Else
   Len2 = Len2 + 2 '¼ÆËãÖÐÎÄ
End If
Next i

MsgBox Len2
×÷Õß: fan0217    ʱ¼ä: 2006-5-21 07:55
Ϊ·½±ãÄãʹÓ㬽«andymarkÌṩµÄ·½·¨¸Ä³ÉÁ˺¯Êý¡£
Function myLen(strString As String) As Integer
Dim intNum As Integer
Dim i As Integer
For i = 1 To Len(strString)
    intNum = Asc(Mid(strString, i, 1))
        If intNum >= 0 And intNum < 128 Then
           myLen = myLen + 1 '¼ÆËãÓ¢ÎÄ
        Else
           myLen = myLen + 2 '¼ÆËãÖÐÎÄ
        End If
Next
End Function






»¶Ó­¹âÁÙ OfficeÖйúÂÛ̳/AccessÖйúÂÛ̳ (http://www.office-cn.net/) Powered by Discuz! X3.3