Advertisement
Advertisement
| 03.05.2008 at 09:39PM PST, ID: 23218559 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.05.2008 at 10:41PM PST, ID: 21057905 |
| 03.06.2008 at 12:31AM PST, ID: 21058337 |
| 03.06.2008 at 12:44AM PST, ID: 21058381 |
| 03.06.2008 at 12:52AM PST, ID: 21058425 |
| 03.06.2008 at 01:06AM PST, ID: 21058483 |
| 03.06.2008 at 06:55AM PST, ID: 21060675 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: |
unit1.dfm
==========
object Form1: TForm1
Left = 192
Top = 114
Width = 544
Height = 420
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 72
Top = 208
Width = 47
Height = 13
Caption = 'Sub string'
end
object Button1: TButton
Left = 312
Top = 248
Width = 177
Height = 41
Caption = 'Last Occurence'
TabOrder = 0
OnClick = Button1Click
end
object Memo1: TMemo
Left = 2
Top = 1
Width = 525
Height = 188
Lines.Strings = (
'procedure TForm1.Button1Click(Sender: TObject);'
' var'
' A, B: WideString;'
' P: PWideChar;'
''
'begin'
' A := Edit1.Text;'
' B := Memo1.Text;'
' P := WStrPos(PWideChar(B), PWideChar(A));'
''
' if P = nil then ShowMessage(''FAIL #1 - P is nil!'')'
' else showmessage(WideString(P));'
'end;')
ScrollBars = ssBoth
TabOrder = 1
end
object Edit1: TEdit
Left = 136
Top = 200
Width = 257
Height = 21
TabOrder = 2
Text = 'showmessage'
end
object Button2: TButton
Left = 48
Top = 248
Width = 201
Height = 41
Caption = 'First Occurence'
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 48
Top = 312
Width = 201
Height = 41
Caption = 'First Occurence(case insensitive)'
TabOrder = 4
OnClick = Button3Click
end
object Button4: TButton
Left = 312
Top = 312
Width = 177
Height = 41
Caption = 'Last Occurence (case insensitive)'
TabOrder = 5
OnClick = Button4Click
end
end
unit1.pas
==========
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Edit1: TEdit;
Label1: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function MyStrPosW(Str, SubStr: PWideChar): PWideChar;
asm
PUSH EDI
PUSH ESI
PUSH EBX
OR EAX, EAX
JZ @@2
OR EDX, EDX
JZ @@2
MOV EBX, EAX
MOV EDI, EDX
XOR AX, AX
MOV ECX, 0FFFFFFFFH
REPNE SCASW
NOT ECX
DEC ECX
JZ @@2
MOV ESI, ECX
MOV EDI, EBX
MOV ECX, 0FFFFFFFFH
REPNE SCASW
NOT ECX
SUB ECX, ESI
JBE @@2
MOV EDI, EBX
LEA EBX, [ESI - 1]
@@1: MOV ESI, EDX
LODSW
REPNE SCASW
JNE @@2
MOV EAX, ECX
PUSH EDI
MOV ECX, EBX
REPE CMPSW
POP EDI
MOV ECX, EAX
JNE @@1
LEA EAX, [EDI - 2]
JMP @@3
@@2: XOR EAX, EAX
@@3: POP EBX
POP ESI
POP EDI
end;
function MyRStrPosW(Str, SubStr: PWideChar): PWideChar;
asm
PUSH EDI
PUSH ESI
PUSH EBX
OR EAX,EAX
JE @@2
OR EDX,EDX
JE @@2
MOV EBX,EAX
MOV EDI,EDX
XOR AX,AX
MOV ECX,0FFFFFFFFH
REPNE SCASW
NOT ECX
DEC ECX
JZ @@2
MOV ESI,ECX
MOV EDI,EBX
MOV ECX,0FFFFFFFFH
REPNE SCASW
NOT ECX
SUB ECX,ESI
JBE @@2
LEA EBX,[ESI-1]
@@1: MOV ESI,EDX
MOV AX,[EDX]
PUSH EBX
LEA EDI,[EDI-4]
@@4: MOV BX,[EDI]
CMP AX,BX
LEA EDI,[EDI-2]
LOOPNE @@4
POP EBX
JNE @@2
LEA EDI,[EDI+2]
MOV EAX,ECX
PUSH EDI
MOV ECX,EBX
REPE CMPSW
POP EDI
MOV ECX,EAX
JNE @@1
LEA EAX,[EDI]
JMP @@3
@@2: XOR EAX,EAX
@@3: POP EBX
POP ESI
POP EDI
end;
procedure TForm1.Button3Click(Sender: TObject);
var
A, B: WideString;
P: PWideChar;
x:Cardinal;
begin
x:=GetTickCount;
A := UpperCase(Edit1.Text);
B := UpperCase(Memo1.Text);
P := MyStrPosW(PWideChar(B), PWideChar(A));
ShowMessage(IntToStr(GetTickCount-x));
if P = nil then ShowMessage('FAIL #1 - P is nil!')
else showmessage(WideString(P));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
A, B: WideString;
P: PWideChar;
x:Cardinal;
begin
x:=GetTickCount;
A := Edit1.Text;
B := Memo1.Text;
P := MyRStrPosW(PWideChar(B), PWideChar(A));
ShowMessage(IntToStr(GetTickCount-x));
if P = nil then ShowMessage('FAIL #1 - P is nil!')
else showmessage(WideString(P));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
A, B: WideString;
P: PWideChar;
x:Cardinal;
begin
x:=GetTickCount;
A := Edit1.Text;
B := Memo1.Text;
P := MyStrPosW(PWideChar(B), PWideChar(A));
ShowMessage(IntToStr(GetTickCount-x));
if P = nil then ShowMessage('FAIL #1 - P is nil!')
else showmessage(WideString(P));
end;
procedure TForm1.Button4Click(Sender: TObject);
var
A, B: WideString;
P: PWideChar;
x:Cardinal;
begin
x:=GetTickCount;
A := UpperCase(Edit1.Text);
B := UpperCase(Memo1.Text);
P := MyRStrPosW(PWideChar(B), PWideChar(A));
ShowMessage(IntToStr(GetTickCount-x));
if P = nil then ShowMessage('FAIL #1 - P is nil!')
else showmessage(WideString(P));
end;
end.
|