Форум: "KOL";
Текущий архив: 2009.05.24;
Скачать: [xml.tar.bz2];
ВнизBinary search Найти похожие ветки
← →
Jon © (2008-01-19 05:21) [0]How can I search within a binary string for a substring?
Both Pos and IndexOfStr fail when a #$00 is encountered.
← →
Vladimir Kladov © (2008-01-19 10:53) [1]I"ll fix IndexOfStr (IndexOfChar) in the update (soon).
← →
Jon © (2008-01-19 19:42) [2]Works perfectly in v2.86 - many thanks!
← →
Jon © (2008-01-20 06:16) [3]
> Works perfectly in v2.86 - many thanks!
Upon further testing I was wrong.
If the substring in IndexOfStr(String,Substring) is not found, the procedure locks up.
Also, if the substring contains #$00 such as IndexOfStr(String,#$00#$FF) the result is the position of first #$00 found.
← →
Vladimir Kladov © (2008-01-20 11:27) [4]PAS_VERSION works perfectly. Here is a fix for asm-version. When you test it, I"ll release an update.
function IndexOfStr( const S, Sub : String ) : Integer;
asm
PUSH EBX
PUSH ESI
PUSH EDI
PUSH EAX
MOV EAX, EDX
PUSH EDX
CALL System.@LStrLen
MOV EDI, EAX
POP EAX
//CALL System.@LStrToPChar
CALL EAX2PChar
MOV BL, [EAX]
XCHG EAX, [ESP]
//CALL System.@LStrToPChar
CALL EAX2PChar
MOV ESI, EAX
DEC EAX
@@1: INC EAX
MOV DL, BL
MOV ECX, [ESI-4]
SUB ECX, EAX
ADD ECX, ESI
CMP ECX, EDI
JL @@ret__1
CALL StrScanLen
TEST EAX, EAX
JE @@exit__1
DEC EAX
POP EDX
PUSH EDX
MOV ECX, EDI
PUSH EAX
//CALL StrLComp
CALL CompareMem
TEST AL, AL
POP EAX
JZ @@1
SUB EAX, ESI
INC EAX
JMP @@exit
@@ret__1:
XOR EAX, EAX
@@exit__1:
DEC EAX
@@exit:
POP EDX
POP EDI
POP ESI
POP EBX
end;
← →
Jon © (2008-01-20 15:32) [5]
> PAS_VERSION works perfectly. Here is a fix for asm-version.
> When you test it, I"ll release an update.
Yes, it works. Thank you and well done!
Страницы: 1 вся ветка
Форум: "KOL";
Текущий архив: 2009.05.24;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.005 c