Changeset 105
- Timestamp:
- Apr 5, 2007, 8:34:33 PM (18 years ago)
- Location:
- trunk/NewView
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NewView/FileDialogForm.pas
r97 r105 123 123 PmWin, 124 124 SysUtils, 125 ACLStringUtility,126 125 FileUtilsUnit, 127 126 ACLDialogs, … … 131 130 SettingsUnit, 132 131 HelpFile, 132 StringUtilsUnit, 133 133 DebugUnit; 134 134 … … 286 286 filename: string; 287 287 ShowList: boolean; 288 NameAndTitle: string;288 tmpNameAndTitle: string; 289 289 Begin 290 290 CompletionsListBox.Items.Clear; … … 295 295 for i := 0 to FileListBox.Items.Count - 1 do 296 296 begin 297 NameAndTitle := FileListBox.Items[ i ];298 Filename := ExtractNextValue( NameAndTitle, #9);299 300 if StrStarts ( search, filename) then297 tmpNameAndTitle := FileListBox.Items[ i ]; 298 Filename := StrLeftUntil(tmpNameAndTitle, [StrTAB]); 299 300 if StrStartsWithIgnoringCase(filename, search) then 301 301 CompletionsListBox.Items.Add( filename ); 302 302 end; … … 306 306 if CompletionsListBox.Items.Count = 1 then 307 307 begin 308 if not Str ingsSame( CompletionsListBox.Items[ 0 ], search) then308 if not StrEqualIgnoringCase(CompletionsListBox.Items[0], search) then 309 309 ShowList := true; 310 310 end … … 436 436 begin 437 437 NameAndTitle := FileListBox.Items[ FileIndex ]; 438 FileNames.Add( ExtractNextValue( NameAndTitle, #9 ));438 FileNames.Add(StrLeftUntil(NameAndTitle, [StrTAB])); 439 439 end; 440 440 end; … … 471 471 begin 472 472 DoErrorDlg( InvalidFilterErrorTitle, 473 Str DoubleQuote( FileNameText)473 StrInDoubleQuotes(FileNameText) 474 474 + InvalidFilterError 475 + EndLine475 + StrCRLF 476 476 + ' \ / :' ); 477 477 exit; … … 611 611 + Filename ); 612 612 613 FileListBox.Items.Add( Filename 614 + #9 615 + Title ); 613 FileListBox.Items.Add(Filename + StrTAB + Title ); 616 614 end; 617 615 FileListBox.Items.EndUpdate; -
trunk/NewView/NavigatePointUnit.pas
r33 r105 48 48 SysUtils, 49 49 ACLUtility, 50 ACLStringUtility; 50 StringUtilsUnit, 51 DebugUnit; 51 52 52 53 procedure SaveWindowList( Var F: TextFile; … … 167 168 constructor TSavedHelpWindow.Load( Var F: TextFile ); 168 169 var 169 s: string;170 tmpString : string; 170 171 TopicIndex: integer; 172 tmpParts : TStringList; 171 173 begin 172 174 inherited Create; … … 174 176 Rect:= THelpWindowRect.Create; 175 177 176 ReadLn( F, S ); 178 ReadLn( F, tmpString); 179 tmpParts := TStringList.Create; 180 StrExtractStrings(tmpParts, tmpString, [','], #0); 177 181 178 TopicIndex := StrToInt( ExtractNextValue( S, ',' ));182 TopicIndex := StrToInt(tmpParts[0]); 179 183 Topic := HelpFile.Topics[ TopicIndex ]; 180 Group := StrToInt( ExtractNextValue( S, ',' ) ); 181 Rect.Left := StrToInt( ExtractNextValue( S, ',' ) ); 182 Rect.Bottom := StrToInt( ExtractNextValue( S, ',' ) ); 183 Rect.Width := StrToInt( ExtractNextValue( S, ',' ) ); 184 Rect.Height := StrToInt( ExtractNextValue( S, ',' ) ); 185 TopCharIndex := StrToInt( ExtractNextValue( S, ',' ) ); 184 Group := StrToInt(tmpParts[1]); 185 Rect.Left := StrToInt(tmpParts[2]); 186 Rect.Bottom := StrToInt(tmpParts[3]); 187 Rect.Width := StrToInt(tmpParts[4]); 188 Rect.Height := StrToInt(tmpParts[5]); 189 TopCharIndex := StrToInt(tmpParts[6]); 190 191 tmpParts.Destroy; 186 192 187 193 LoadWindowList( F, ChildWindows, HelpFile ); -
trunk/NewView/StringUtilsUnit.pas
r102 r105 13 13 14 14 const 15 StrTAB = chr(9); 15 16 StrCR = chr(13); 16 17 StrLF = chr(10); … … 76 77 Function StrLeftUntil(const aReceiver: String; const aSetOfChars: TSetOfChars) : String; 77 78 78 // returns true if the String starts with the provide sone79 // returns true if the String starts with the provided one 79 80 // this is case SENSITIVE 80 81 Function StrStartsWith(const aReceiver: String; const aStartString: String): Boolean; 81 82 82 // returns true if the String starts with the provide sone83 // returns true if the String starts with the provided one 83 84 // this is case INsensitive 84 85 Function StrStartsWithIgnoringCase(const aReceiver: String; const aStartString: String): Boolean; … … 88 89 Function StrEndsWith(const aReceiver: String; const anEndString: String): Boolean; 89 90 90 // returns true if the String ends with the provide sone91 // returns true if the String ends with the provided one 91 92 // this is case INsensitive 92 93 Function StrEndsWithIgnoringCase(const aReceiver: String; const anEndString: String): Boolean; 94 95 // returns true if the Strings are the same 96 // this is case INsensitive 97 Function StrEqualIgnoringCase(const aReceiver: String; const aSecondString: String): Boolean; 93 98 94 99 // the IntToStr generates wrong results … … 106 111 107 112 uses 113 SysUtils, 108 114 DebugUnit; 109 115 … … 502 508 503 509 510 Function StrEqualIgnoringCase(const aReceiver: String; const aSecondString: String): Boolean; 511 begin 512 Result := CompareText(aReceiver, aSecondString) = 0; 513 end; 514 515 504 516 Function LongWordToStr(const aLongWord: LongWord) : String; 505 517 Var -
trunk/NewView/unittests/StringUtilsUnitTests.pas
r102 r105 410 410 END; 411 411 412 PROCEDURE testStrExtractStrings_DelimiterSameAsEscapeChar; 413 VAR 414 tmpResult : TStringList; 415 BEGIN 416 tmpResult := TStringList.Create; 417 StrExtractStrings(tmpResult, 'a;b;;cd;;;', [';'], ';'); 418 419 assertEqualsInt('testStrExtractStrings_EscapedEscapeChar', 3, tmpResult.count); 420 assertEqualsString('testStrExtractStrings_EscapedEscapeChar', 'a', tmpResult[0]); 421 assertEqualsString('testStrExtractStrings_EscapedEscapeChar', 'b;cd;', tmpResult[1]); 422 assertEqualsString('testStrExtractStrings_EscapedEscapeChar', '', tmpResult[2]); 423 424 tmpResult.Destroy; 425 END; 412 426 413 427 // ------------------------------------------------------ … … 1267 1281 1268 1282 1283 // ---------------------------------------------------------- 1284 1285 1286 PROCEDURE testStrEqualIgnoringCase_BothEmpty; 1287 VAR 1288 tmpResult : Boolean; 1289 BEGIN 1290 tmpResult := StrEqualIgnoringCase('', ''); 1291 1292 assertTrue('testStrEqualIgnoringCase_BothEmpty', tmpResult); 1293 END; 1294 1295 1296 PROCEDURE testStrEqualIgnoringCase_FirstEmpty; 1297 VAR 1298 tmpResult : Boolean; 1299 BEGIN 1300 tmpResult := StrEqualIgnoringCase('', 'xy'); 1301 1302 assertFalse('testStrEqualIgnoringCase_FirstEmpty', tmpResult); 1303 END; 1304 1305 PROCEDURE testStrEqualIgnoringCase_SecondEmpty; 1306 VAR 1307 tmpResult : Boolean; 1308 BEGIN 1309 tmpResult := StrEqualIgnoringCase('xy', ''); 1310 1311 assertFalse('testStrEqualIgnoringCase_SecondEmpty', tmpResult); 1312 END; 1313 1314 PROCEDURE testStrEqualIgnoringCase_DifferentLength; 1315 VAR 1316 tmpResult : Boolean; 1317 BEGIN 1318 tmpResult := StrEqualIgnoringCase('xy', 'xyz'); 1319 1320 assertFalse('testStrEqualIgnoringCase_DifferentLength', tmpResult); 1321 END; 1322 1323 PROCEDURE testStrEqualIgnoringCase_DifferentCase; 1324 VAR 1325 tmpResult : Boolean; 1326 BEGIN 1327 tmpResult := StrEqualIgnoringCase('xYz', 'xyz'); 1328 1329 assertTrue('testStrEqualIgnoringCase_DifferentCase', tmpResult); 1330 END; 1331 1332 PROCEDURE testStrEqualIgnoringCase; 1333 VAR 1334 tmpResult : Boolean; 1335 BEGIN 1336 tmpResult := StrEqualIgnoringCase('XYz', 'XYz'); 1337 1338 assertTrue('testStrEqualIgnoringCase', tmpResult); 1339 END; 1340 1341 // ---------------------------------------------------------- 1342 1343 1269 1344 PROCEDURE testLongWordToStr_Zero; 1270 1345 VAR … … 1296 1371 1297 1372 1373 // ---------------------------------------------------------- 1374 1298 1375 1299 1376 PROCEDURE testBoolToStr_true; … … 1315 1392 assertEqualsString('testBoolToStr_false', 'False', tmpResult); 1316 1393 END; 1394 1317 1395 1318 1396 // ---------------------------------------------------------- … … 1375 1453 result.add(@testStrExtractStrings_EscapedDelimiter); 1376 1454 result.add(@testStrExtractStrings_EscapedEscapeChar); 1455 result.add(@testStrExtractStrings_DelimiterSameAsEscapeChar); 1377 1456 1378 1457 result.add(@testStrExtractStringsIgnoreEmpty_EmptyReceiver); … … 1467 1546 result.add(@testStrEndsWithIgnoringCase_StringMatchCaseInSensitive); 1468 1547 1548 result.add(@testStrEqualIgnoringCase_BothEmpty); 1549 result.add(@testStrEqualIgnoringCase_FirstEmpty); 1550 result.add(@testStrEqualIgnoringCase_SecondEmpty); 1551 result.add(@testStrEqualIgnoringCase_DifferentLength); 1552 result.add(@testStrEqualIgnoringCase_DifferentCase); 1553 result.add(@testStrEqualIgnoringCase); 1554 1469 1555 result.add(@testLongWordToStr_Zero); 1470 1556 result.add(@testLongWordToStr_Four);
Note:
See TracChangeset
for help on using the changeset viewer.