Saturday, September 25, 2010

Delphi study: to find any string in the stream


寮?彂涓湁鏃堕渶瑕佸湪娴佷腑鏌ユ壘鏌愪釜瀛椾覆,杩欎簺瀛椾覆鏈夊彲鑳芥槸ASCII琛ㄥ悗鍗婇儴鍒嗘垨娣锋潅.浣嗘槸缃戜笂鎻愪緵鐨勪緥绋嬫晥鏋滀笉浣宠?涓斾唬鐮佸啑闀?

Later, a pumping of time writing code very small, very efficient. Only for your reference:

function ScanStream (T: Tstream; S: String): integer;
var i, j: integer;
p: Pchar;
begin
getMem (p, T.size); / / allocate memory
T. ReadBuffer (p ^, t.Size); / / Reading

for i: = 0 to T. Size -1 do begin
for j: = 1 to length (S) do
if p [i + j] <> S [j] then break; / / have a different or out of
銆??if j&gt;length(S) then begin file//渚濇嵁
result: = i +1;
銆??break; file//瀹屾垚
end;
end;
FreeMem (p);
end;





相关链接:



Town And Only "limited Earnings"



Lists Mathematics Education



Sonic Foundry Vegas 4.0 Dynamic Subtitles Novice Collection 16



Basij to gates the new company to sell anti virus



XviD to WMV



MKV To Zune



E-Mail Clients Shop



Common understanding between the main types of disc Burning



JSN-1 (A) Digital Switching Introduction



Official Air Strike 2 Cheats



Is out of date, ADSL Anecdotes



Thunder look at real-time on-demand player in the player to build pan-



DDSN Analysis, PLM value for the DDSN



Carried out in the end to P2P: the story about the Jxta (2)



AVI to DivX



No comments:

Post a Comment