Ignore:
Timestamp:
Feb 23, 2021, 10:47:47 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Optimized TurnToYear function to eliminate unnecessary loop.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/StringTables.pas

    r174 r286  
    1919    function GetHandle(const Item: string): integer;
    2020    function LookupByHandle(Handle: integer; Index: integer = -1): string;
    21     function Lookup(const Item: string; Index: integer = -1): string;
     21    function Lookup(const Item: string; Index: Integer = -1): string;
    2222    function Search(const Content: string; var Handle, Index: integer): boolean;
    2323  end;
     
    9999end;
    100100
    101 function TStringTable.Lookup(const Item: string; Index: integer): string;
     101function TStringTable.Lookup(const Item: string; Index: Integer): string;
    102102var
    103   Handle: integer;
     103  Handle: Integer;
    104104begin
    105105  Handle := GetHandle(Item);
    106106  if Handle >= 0 then
    107     result := LookupByHandle(Handle, Index)
     107    Result := LookupByHandle(Handle, Index)
    108108  else
    109     result := '';
    110   if result = '' then
     109    Result := '';
     110  if Result = '' then
    111111    if Index < 0 then
    112       result := Format('[%s]', [Item])
     112      Result := Format('[%s]', [Item])
    113113    else
    114       result := Format('[%s %d]', [Item, Index])
     114      Result := Format('[%s %d]', [Item, Index])
    115115end;
    116116
Note: See TracChangeset for help on using the changeset viewer.