½Ð±Ðmid¡Bmidb¡Blen¡Blenb°ÝÃD
- ©«¤l
- 97
- ¥DÃD
- 26
- ºëµØ
- 0
- ¿n¤À
- 158
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- taichung
- µù¥U®É¶¡
- 2010-9-12
- ³Ì«áµn¿ý
- 2019-8-29
|
¥»©«³Ì«á¥Ñ lionliu ©ó 2016-1-18 09:42 ½s¿è
¦^´_ 3# lionliu
ÁÂÁÂml¤jô¡A§Ú¦b´ú¸Õ¤@¤U¡C |
|
lionliu
|
|
|
|
|
- ©«¤l
- 2025
- ¥DÃD
- 13
- ºëµØ
- 0
- ¿n¤À
- 2053
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- Office2007
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_¥«
- µù¥U®É¶¡
- 2011-3-2
- ³Ì«áµn¿ý
- 2024-3-14
|
¦^´_ 3# lionliu
½Ð¬Ý³o½g»¡©ú
http://forum.twbts.com/thread-31-1-1.html
Len ¨ç¼Æ½d¨Ò
²Ä¤@Ó½d¨Ò¨Ï¥Î Len ¶Ç¦^¬Y¦r¦êªºªø«×(¦r¤¸¼Æ)©Î¬YÅܼƪº¤j¤p(¦ì¤¸¼Æ)¡CType...End Type µ{¦¡°Ï¶ô©w¸q¤@Ó¦Ûq¸ê®Æ«¬ºA CustomerRecord¡C¦pªG¸Ó¸ê®Æ«¬ºA©w¸q¦bª«¥óÃþ§O¼Ò²Õ¤¤¡A«h¥²»Ý¥HÃöÁä¦r Private ¶}ÀY(ªí¥Ü¬°¨p¦³)¡CY©w¸q¦b¤@¯ë¼Ò²Õ¤¤¡AType ©w¸q´N¥i¥H¬° Public¡C
Type CustomerRecord ' ©w¸q¨Ï¥ÎªÌ¦Ûqªº¸ê®Æ«¬ºA¡C
ID As Integer ' ±N¦¹©w¸q©ñ¦b¤@¯ë¼Ò²Õ¤¤¡C
Name As String * 10
Address As String * 30
End Type
Dim Customer As CustomerRecord ' «Å§iÅܼơC
Dim MyInt As Integer, MyCur As Currency
Dim MyString, MyLen
MyString = "Hello World" ' ³]©wÅܼƪìÈ¡C
MyLen = Len(MyInt) ' ¶Ç¦^ 2¡C
MyLen = Len(Customer) ' ¶Ç¦^ 42¡C
MyLen = Len(MyString) ' ¶Ç¦^ 11¡C
MyLen = Len(MyCur) ' ¶Ç¦^ 8¡C
¦pªG¥ÎANSIªí¥Ü¦r¦êªº¸Ü¡A²Ä¤GÓ½d¨Ò¨Ï¥Î LenB©M¨Ï¥ÎªÌ©w¸qªº¨ç¼Æ (LenMbcs) ¶Ç¦^¬Y¦r¦êªºªø«×(¦r¤¸¼Æ)¡C
Function LenMbcs (ByVal str as String)
LenMbcs = LenB(StrConv(str, vbFromUnicode))
End Function
Dim MyString, MyLen
MyString = "ABc"
' "A" ©M "B" ¬O DBCS¥B "c" ¬OSBCS¡C
MyLen = Len(MyString)
' ¶Ç¦^¦r¦ê¤¤¦³3 ¡V3 Ó¦r¤¸¡C
MyLen = LenB(MyString)
' ¶Ç¦^ 6 ¡V 6 ¦ì¤¸¥Î©óUnicode¡C
MyLen = LenMbcs(MyString)
' ¶Ç¦^ 5 - 5Ӧ줸¥Î©óANSI¡C |
|
{...} ªí¥Ü»Ýn¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡
|
|
|
|
|
- ©«¤l
- 97
- ¥DÃD
- 26
- ºëµØ
- 0
- ¿n¤À
- 158
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- taichung
- µù¥U®É¶¡
- 2010-9-12
- ³Ì«áµn¿ý
- 2019-8-29
|
¦^´_ 2# ML089
ÁÂÁª©¤j¦^ÂÐ
§Úªº°ÝÃD¬Omidb(range,1,20)¬°¤°»ò^¼Æ³£ºâÂù¦r¤¸¡C
§Úªº»Ý¨D¬O20¦r¤¸¡A^¼Æ¤¤¤å²V¦X¡C |
|
lionliu
|
|
|
|
|
- ©«¤l
- 2025
- ¥DÃD
- 13
- ºëµØ
- 0
- ¿n¤À
- 2053
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- Office2007
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_¥«
- µù¥U®É¶¡
- 2011-3-2
- ³Ì«áµn¿ý
- 2024-3-14
|
¦^´_ 1# lionliu
§Aªº½d¨Ò¤¤ A1 = "abc123, abc 123 abc123§Ú·d¤£©w MID( ),MIDB( )¡ALEN( ) LENB( ) stuwxyz"
LEN(A1) = 64
LENB(A1) = 69
ªí¥Ü 69-64=5 ¦³5ÓÂù¦r¤¸
¤£¤F¸Ñ§An¨D¬Æ»ò? |
|
{...} ªí¥Ü»Ýn¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡
|
|
|
|
|