VBÖеÄUnicode ºÍ Ansi ¸ñʽ ת»»
VBÖеÄUnicode ºÍ Ansi ¸ñʽ
Visual Basic 32-bit °æ±¾µÄ×Ö´®´¦Àí²ÉÓà Unicode£¬Ò²¾ÍÊÇ˵×Ö´®ÔÚ VB ÄÚ²¿ÊÇÒÔUnicode µÄ¸ñʽÀ´´æ·Å¡£ºÎν Unicode£¿¼òµ¥µÄ˵£¬¾ÍÊÇÿһ¸ö×Ö·û¶¼ÊÇÒÔ 2-byte µÄÐÎʽ±íʾ£¬¶øÿ¸ö¡¸ÊµÌå×Ö·û¡¹¾ÍÊÇÒ»¸ö¡¸×Ö·û¡¹¡£Òò´Ë£¬
Len("´ó¼ÒºÃ")
Len("abc")
Ëù·µ»ØµÄÖµ¶¼ÊÇ 3£¬ÒòΪ¡¸´ó¡¹ºÍ¡¸a¡¹¶¼ÊÇÒ»¸ö×Ö·û¡£
µ«ÊÇÕâ¶ÔһЩÖÐÎÄ×Ö´®´¦Àí£¬ÀýÈç´¿ÎÄ×ÖµÄÊý¾ÝÎļþ£¬È´ÊÇÒ»¸ö´óÔÖÄÑ£¬ÒòΪÄã±ØÐëÒÔbyte À´¶¨Î»Ã¿¸ö×Ö·û£¬¿ÉÊÇ Unicode È´°ÑÒ»ÇеĴ¦ÀíÈ«¸ãÔÒÁË¡£ÀýÈ磺
Len("Good Morning") ·µ»Ø 12£¬¶ø
Len("½ñÌìÌìÆøºÜºÃ") ·µ»Ø 6
¶Ô³õѧÕ߶øÑÔ£¬ºÃ²»ÈÝÒ×ÄÜʹÓà VB À´Ð´³ÌÐòÒѾÊǼþÁ˲»ÆðµÄÊÂÁË£¬È´ÂíÉÏÔÚÖÐÎÄ´¦ÀíÉÏ°¤ÁËÒ»¼ÇÃƹ÷£¬ËùÊܵ½µÄ´ò»÷ʵÔÚ²»Ð¡¡£µ«ÊDz»ÒªÅ£¬ÊÂʵÉÏÖ»ÒªÔÙ¶àÁ˽âһЩָÁ¾Í¿ÉÒÔ°ÑÖÐÎÄ´¦ÀíµÄÎÊÌâ½â¾öÁË¡£
ÊÇʲôָÁîÄØ£¿×îÖØÒªµÄĪ¹ýÓÚ StrConv ÁË¡£StrConv º¯ÊýµÄÓ﷨Ϊ£ºStrConv(´ýת»»×Ö´®, ת»»¸ñʽ)
ÆäÖÐת»»¸ñʽÔÚÕâÀïÓõ½µÄÊÇ£º
vbUnicode ½« Ansi ×Ö´®×ª»»Îª Unicode
vbfromUnicode ½« Unicode ×Ö´®×ª»»Îª Ansi
½«×Ö´®×ª³É Ansi Ö®ºó£¬ËùÓеÄ×Ö´®´¦ÀíÖ¸ÁҪ¼Ó¸ö B£¬ÀýÈ磺LeftB, RightB,
MidB, ChrB, InstrB, LenB, InputB µÈ¡£ÀýÓÃÕâЩָÁîÀ´´¦Àí¾ÍÐÐÁË¡£
µ±Äã´¦ÀíÍê±ÏÖ®ºó£¬Äã¿ÉÒÔÔÙ½«ËüÔÙת»Ø Unicode£¬ÕâÑù¾Í¿ÉÒÔʹÓÃÒ»°ãµÄ×Ö´®´¦ÀíÖ¸ÁîÁË¡£ÕâÑù½²¿´µÃ¶®Âð£¿Èç¹û»¹ÊDz»Á˽⣬¿´¿´ÏÂÃæµÄʵÀý˵Ã÷£º
¼òÒ×ʹÓ÷¶Àý
¿´¿´ÏÂÃæµÄ»ù±¾·¶ÀýÄúÓ¦¸Ã¾Í»á¶Ô VB µÄ×Ö´®´¦Àí·½Ê½ÓÐЩ¸ÅÄî¡£
Private Sub Command1_Click ()
Dim sUnicode As String
Dim sAnsi As String
' Unicode ÔËËã
sUnicode = "ÍõСÃ÷,A123456789,651023,ÉϺ£ÊÐÖÐɽ·100ºÅ,(02)2345678"
Debug.Print Len(sUnicode) ' ·µ»Ø 44
Debug.Print Mid$(sUnicode, 5, 10) ' ·µ»Ø A123456789
Debug.Print Instr(sUnicode, "ÉϺ£ÊÐ") ' ·µ»Ø 23
' ½« Unicode ×Ö´®×ª³É Ansi
sAnsi = StrConv(sUnicode, vbfromUnicode)
' Ansi ÔËËã
Debug.Print LenB(sAnsi) ' ·µ»Ø 54
Debug.Print MidB$(sAnsi, 8, 10) ' ·µ»Ø ?????£¬ÒòΪÍüÁËת»Ø Unicode
Debug
Ïà¹ØÎĵµ£º
ת×Ô£ºhttp://www.52arm.com/Article_Show.asp?ArticleID=186
×÷Õߣºweidian ---±¾Õ¾Ô´´ µã»÷Êý£º4721 ·¢±íʱ¼ä£º2008-5-7 ±à¼£ºsanzang
Winsock¿Ø¼þ½¨Á¢ÔÚTCP¡¢UDPÐÒéµÄ»ù´¡ÉÏ£¬Íê³ÉÓëÔ¶³Ì¼ÆËã»úµÄ ......
Ôںܶà VB µÄ×ÊÁÏ¿âÊé¼®ÖУ¬¶¼»áºÜÍêÕûµÄÌáµ½£ºÈçºÎÓÉÆäËûÖÖÀàµÄÎļþÖн«×ÊÁϵ¼Èë×ÊÁϿ⣬µ«ÊÇÈ´ºÜÉÙÓÐÊéÌáµ½£ºÈçºÎ½«×ÊÁÏ¿âÖеÄ×ÊÁÏ£¬µ¼³öµ½¸÷ÖÖ²»Í¬µÄÎļþÀàÐ͵ÄÎļþÖУ¬Á¬ VB µÄ Help ÖÐÒ²ÊÇÕâÑù£¡
»òÐíÊÇ´ó¼Ò¶¼ÈÏΪ×ÊÁÏ¿âÖ÷ÌâµÄÖصãÊÇÔÚ×ÊÁÏ¿â±¾Éí°É£¡
µ«ÊÇ£¬ÔÚʵ¼ÊµÄ×ÊÁÏ¿â³ÌÐòÔËÓÃÖУ¬È´³£³£ÐèÒª½«×ÊÁÏ¿âµ¼³öµ½¸÷ÖÖ ......
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
......
ÎÄÕÂÀ´Ô´:vb´óÊÀ½ç ×÷ÕߣºÍõ¹úÈÙ
¡¸VB ûÓÐÌṩÕâÑùµÄ¹¦ÄÜ£¬ ±ØÐëºô½Ð Windows API¡¹£¬ µ±±ÊÕßÕâÑù»Ø´ð¶ÁÕßÖ®áᣬÓÐЩ¶ÁÕß»áÒªÇó±ÊÕß½éÉÜ Windows API ·½ÃæµÄÊé¼®£¬ ÓÈÆäÊÇÖÐÎÄÊ飬 µ«Êµ¼ÊÉÏ£¬Ä¿Ç°ÊÐÃæÉÏÖ»¿´µ½Ò»±¾ÔÎÄÊé(ZD Press ³ö°æµÄ Visual Basic 5.0 Programming Guide to Win32 API)£¬ ÖÐÎÄÊéÔòδ¼û¹ý£¬ Ϊʲ÷áÃ»Ó ......
×÷Õß: ØýÃû, ¡¡³ö´¦:ITר¼ÒÍø,¡¡ÔðÈαà¼: лåûåû,¡¡
2010-04-23 11:20
¡¡¡¡±¾ÎĽéÉÜVB¶Ô³ÌÐòÔËÐеļà¿Ø¡£
¡¡¡¡×ªÑۼ䣬±¾ÏµÁÐÎÄÕÂÒѾдµ½Á˵ÚÁù¸ö£¬½ñÌìдµãʲôÄØ?
¡¡¡¡»¹ÊǵÃд£¬¿´ËÆVB×ö²»µ½µÄÊÂÇ飬ÄÇô½ñÌìÆð¾ÍддVB¶Ô²Ù×÷ϵͳµÄ¿ØÖÆ°É¡£
¡¡¡¡Ê×ÏÈ£¬ËµÒ»Ëµ£¬VB¶ÔÓÚ±»µ÷ÓúóµÄ³ÌÐòµÄ¼à¿Ø·½·¨¡£
¡¡¡¡ÔÐͺ¯Êý¼ò ......