lenle|len(),lift(),right()不能正常识别中文的用户请进!

更新时间:2013-12-21    来源:中文酷站    手机版     字体:

【www.bbyears.com--中文酷站】

以下用法和len(),lift(),right()一样。
Function Strlength(Str)
    Temp_Str=Len(Str)
    For I=1 To Temp_Str
        Test_Str=(Mid(Str,I,1))
        If Asc(Test_Str)>0 Then
       Strlength=Strlength+1
        Else
       Strlength=Strlength+2
        End If
    Next
End Function
Function Strleft(Str,L)
    Temp_Str=Len(Str)
    For I=1 To Temp_Str
        Test_Str=(Mid(Str,I,1))
        Strleft=Strleft&Test_Str
        If Asc(Test_Str)>0 Then
       lens=lens+1
        Else
       lens=lens+2
        End If
       If lens>=L Then Exit For
    Next
End Function
Function Strright(Str,L)
    Temp_Str=Len(Str)
    For    i = Temp_Str to 1 step -1
        Test_Str=(Mid(Str,I,1))
        Strright=Test_Str&Strright
        If Asc(Test_Str)>0 Then
       lens=lens+1
        Else
       lens=lens+2
        End If
       If lens>=L Then Exit For
    Next
End Function

本文来源:http://www.bbyears.com/kuzhan/2858.html

热门标签

更多>>

本类排行