½Ð±Ð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
|
½Ð±Ðmid¡Bmidb¡Blen¡Blenb°ÝÃD
¤j®a¦n¡G
·Q½Ð±Ð len()·fmid()^¼Æ¦rû»P¤¤¤å¦r¤¸¡Alenb()·fmidb()^¼Æ¤¤¤å¦r¤¸ºâªk
§Ú¦³»s§@¤@Ó½d¨Ò°ÝÃD
¬¡¶Ã¯1.rar (12.48 KB)
§ÚªººÃ°Ý¬Omidb¡Blenb¹ï^¼Æ¬°¦ó¤]¬OÂù¦r¤¸
¦³¿ìªkÅý^¼Æºâ³æ¦r¤¸¡A¤¤¤åºâÂù¦r¤¸ªº¤èªk¶Ü? |
|
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¤½¦¡
|
|
|
|
|
- ©«¤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
|
¦^´_ 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
|
¥»©«³Ì«á¥Ñ 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
|
¥[¤J
Function xMidB(ByVal str As String, start, length)
xMidB = StrConv(MidB(StrConv(str, vbFromUnicode), start, length), vbUnicode)
End Function
Function xLenB(ByVal str As String)
xLenB = LenB(StrConv(str, vbFromUnicode))
End Function
±Nìµ{¦¡¤¤ªº LenB §ï¬° xLenB
±Nìµ{¦¡¤¤ªº MidB §ï¬° xMidB |
|
{...} ªí¥Ü»Ýn¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡
|
|
|
|
|
- ©«¤l
- 2834
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2890
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-27
|
¥»©«³Ì«á¥Ñ ã´£³¡ªL ©ó 2016-1-18 15:45 ½s¿è
¸û²³æªº¤èªk¡G
xLenB = Evaluate("LenB(""" & Range("A1") & """)")
MsgBox xLenB
Y¤¤¤å§t¦³¡e²Åé¦r¡f©Î¨ä¥¦¥~¦r½X¥þ«¬¦r¡AxLenB ·|¶Ç¦^¢°¡A©Ò¥HÁÙ¬O¤£¥i¾a¡A
¨Ò¦p¡G堃¡D々¡D国¡D龥....µ¥µ¥
¥i¦Ò¼{¡e¥¿«h¡f¤èªk¡A¦ý§Ú¤£¼ô¥Î¡A½Ð¤Wºô§ä²{¦¨¬Ý¬Ý¡ã¡ã |
|
|
|
|
|
|
- ©«¤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
|
¦^´_ 7# ã´£³¡ªL
ÁÂÁ Mj»Pã¤j2¦ì¤jôªº¦^ÂСAì¨ÓmedbÁÙn³o¼Ë§ï¡A§Ú·Q»¡¤@ª½¥X²{¶Ã½X¤£ª¾þ¨½¥X¿ù¥¿·Q¦A½Ð±Ð¡C§Ú¦A¸Õ¬Ý¬Ý¡C |
|
lionliu
|
|
|
|
|
- ©«¤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
|
¦^´_ 6# ML089
ÁÂÁÂMJ¤j¤j¡G
§Ú´ú¸Õ«á³£¥¿±`¤F¡C |
|
lionliu
|
|
|
|
|
- ©«¤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-19 15:30 ½s¿è
¦^´_ 6# ML089
¦^´_ 8# ã´£³¡ªL
2¦ì¤jô¦n¡G
¸g¹L´ú¸Õ«áµo²{2Ó°ÝÃD¡Amj¤j¤jªº¤èªkY¤¤¤å¦r¦êè¦n¦b¤Á³ÎÂI·|Åܦ¨?¡A¤U¤@¦æ²Ä¤@®æ¦r¤]¬O?¡A¤¤¤å¦rå¥b¡C
ã¤jªº¤èªk§Ú²Ä¤@¦¸¥Îmidb¤£·|§ï¡A§Ú¹L§Ú¥Î¤FÃþ¦¡ªº²Â¤èªk¡A"=midb(a1,1,20)"¥´¤½¦¡ªº¤è¦¡¡Aµ²ªG·|¦n¤@ÂI¡A¦ý¬Oµo²{·|±¼¦r(¤¤¤å¦rè¦n¦b¤À³ÎÂI®É)¡A¥Ø«e©|¦b¬ã¨s´ú¸Õ¤¤¡C |
|
lionliu
|
|
|
|
|