Comparison of string processing functions in VB

xiaoxiao2021-03-06  113

Simple code is used in contrast of disassembly test:

String handler test code without $ without $: DIM S AS STRING

Private submmand1_click () s = left ("Test Str", 3) End Sub

SC can know the entry point of Command1_Click: 00401A30

Disassembly code: 00401A84. C745 C0 CC1640> MOV DWORD PTR SS: [EBP-40], WITHOUTI.00401>; Unicode "Test Str" 00401A8B. C745 B8 080000> MOV DWORD PTR SS: [EBP-48], 800401A92. FF15 6C104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaVarDu>; MSVBVM60 .__ vbaVarDup00401A98 8D55 D8 LEA EDX, DWORD PTR SS:... [EBP-28] 00401A9B 6A 03 PUSH 300401A9D 8D45 C8 LEA EAX, DWORD PTR SS: [EBP .. -38] 00401AA0 52 PUSH EDX00401AA1 50 PUSH EAX00401AA2 FF15 70104000 CALL DWORD PTR DS: [<& MSVBVM60 # 617.>]; MSVBVM60.rtcLeftCharVar00401AA8 8D4D C8 LEA ECX, DWORD PTR SS:.. [EBP-38] 00401AAB 51. PUSH ECX00401AAC FF15 08104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaStrVa>; MSVBVM60 .__ vbaStrVarMove00401AB2 8BD0 MOV EDX, EAX00401AB4 8D4D E8 LEA ECX, DWORD PTR SS:.... [EBP-18] 00401AB7 FF15 78104000 CALL DWORD PTR DS: [<& Msvbvm60 .__ vbastrmo>; MSVBVM60 .__ vbastrmove00401abd. 8bd0 MOV EDX, EAX00401ABF. 8D4E 34 LEA ECX, DWORD PTR DS: [ESI 34] 00401AC2 FF15 5C104000 CALL DWORD PTR DS:. [<& MSVBVM60 .__ vbaStrCo>; MSVBVM60 .__ vbaStrCopy00401AC8 8D4D E8 LEA ECX, DWORD PTR SS:.. [EBP-18] 00401ACB FF15 88104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaFreeS>; MSVBVM60 .__ vbaFreeStr00401AD1 8D55 C8 LEA EDX, DWORD PTR SS:... [EBP-38] 00401AD4 8D45 D8 LEA EAX, DWORD PTR SS: [EBP-28] 00401AD7 52 PUSH EDX00401AD8. 50 push eax00401ad9. 6a 02 push 200401adb. Ff15 0c104000 Call DWORD PTR DS: [<& MSVBVM60 .__ vbafreev>;

. MSVBVM60 .__ vbaFreeVarList00401AE1 83C4 0C ADD ESP, 0C00401AE4 897D FC MOV DWORD PTR SS:.... [EBP-4], EDI00401AE7 68 0C1B4000 PUSH WITHOUTI.00401B0C00401AEC EB 1D JMP SHORT WITHOUTI.00401B0B00401AEE 8D4D E8 LEA ECX, DWORD PTR SS: [EBP-18] 00401AF1 FF15 88104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaFreeS>; MSVBVM60 .__ vbaFreeStr00401AF7 8D4D C8 LEA ECX, DWORD PTR SS:... [EBP-38] 00401AFA 8D55 D8 LEA EDX, DWORD PTR SS: .. [EBP-28] 00401AFD 51 PUSH ECX00401AFE 52 PUSH EDX00401AFF 6A 02 PUSH 200401B01 FF15 0C104000 CALL DWORD PTR DS:.. [<& MSVBVM60 .__ vbaFreeV>; MSVBVM60 .__ vbaFreeVarList with $ string handling functions test Code: Dim s As String

Private submmand1_click () s = left ("Test Str", 3) End Sub

SC can know the entry point of Command1_Click: 004019E0

Anti-assembly code: 00401A24. 68 B4164000 Push withit.004016B4; UNICODE "test str" 00401a29. 897d E8 MOV DWORD PTR SS: [EBP-18], EDI00401A2C. Ff15 64104000 Call DWORD PTR DS: [<& msvbvm60. # 616>] ; MSVBVM60.rtcLeftCharBstr00401A32 8BD0 MOV EDX, EAX00401A34 8D4D E8 LEA ECX, DWORD PTR SS:... [EBP-18] 00401A37 FF15 6C104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaStrMo>; MSVBVM60 .__ vbaStrMove00401A3D 8BD0 MOV EDX, EAX00401A3F. .. 8D4E 34 LEA ECX, DWORD PTR DS: [ESI 34] 00401A42 FF15 54104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaStrCo>; MSVBVM60 .__ vbaStrCopy00401A48 8D4D E8 LEA ECX, DWORD PTR SS:. [EBP-18] 00401A4B . FF15 7C104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbaFreeS>; MSVBVM60 .__ vbaFreeStr00401A51 897D FC MOV DWORD PTR SS:.... [EBP-4], EDI00401A54 68 661A4000 PUSH WITHIT.00401A6600401A59 EB 0A JMP SHORT WITHIT.00401A6500401A5B 8D4D E8 Lea ECX, DWORD PTR SS: [EBP-18] 00401A5E . FF15 7C104000 CALL DWORD PTR DS: [<& MSVBVM60 .__ vbafrees>; MSVBVM60 .__ VBAFREESTR can be seen that there is a lot of functions that do not bring a function of a function with $, and the resource release is more troubles with $ with $. , Its efficiency can be much worse than the function with $

The two types of functions are only one $, so I suggest that you use the functions tabby.

转载请注明原文地址:https://www.9cbs.com/read-102627.html

New Post(0)