AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Nummerierung

Ein Thema von robinWie · begonnen am 26. Aug 2006 · letzter Beitrag vom 9. Sep 2006
 
Benutzerbild von robinWie
robinWie

Registriert seit: 26. Okt 2005
Ort: Lippcity
404 Beiträge
 
Delphi 2005 Personal
 
#1

Nummerierung

  Alt 26. Aug 2006, 16:50
Hallo,
wer kennt das nicht. Man will etwas Nummerieren aber der Explorer zeigt, bei einfacher nummerierung, die Dateien so an:
Code:
1Datei
10Datei
11Datei
2Datei
3Datei
4Datei
5Datei
6Datei
7Datei
8Datei
9Datei
Das hat mich sehr gestört. Da habe ich einen Algo geschrieben der das ganze so Nummeriert:
Code:
01. Datei
02. Datei
03. Datei
04. Datei
05. Datei
06. Datei
07. Datei
08. Datei
09. Datei
10. Datei
11. Datei
Hier iser
Leider unterstüzt er "nur" maximal 1.000.000 Einträge
Delphi-Quellcode:
function GetNumber(Position, Max: integer): string;
var
 NOM: string;
begin
      if Length(IntToStr(Position+1))=1 then begin
         if Max >= 100000 then
            NOM:='00000'+IntToStr(Position+1)+'. ';
         if (Max>=10000) and (Max <100000) then
            NOM:='0000'+IntToStr(Position+1)+'. ';
         if (Max>=1000) and (Max<10000) then
            NOM:='000'+IntToStr(Position+1)+'. ';
         if (Max>=100) and (Max<1000) then
            NOM:='00'+IntToStr(Position+1)+'. ';
         if (Max>=10) and (Max<100) then
            NOM:='0'+IntToStr(Position+1)+'. ';
         if (Max>=1) and (Max<10) then
            NOM:=IntToStr(Position+1)+'. ';
       end;
       if Length(IntToStr(Position+1))=2 then begin
         if Max >=10000 then
            NOM:='0000'+IntToStr(Position+1)+'. ';
         if (Max>=10000) and (Max <10000) then
            NOM:='000'+IntToStr(Position+1)+'. ';
         if (Max>=1000) and (Max<10000) then
            NOM:='00'+IntToStr(Position+1)+'. ';
         if (Max>=100) and (Max<1000) then
            NOM:='0'+IntToStr(Position+1)+'. ';
         if Max<100 then
            NOM:=IntToStr(Position+1)+'. ';
       end;
       if Length(IntToStr(Position+1))=3 then begin
         if Max>=100000 then
            NOM:='000'+IntToStr(Position+1)+'. ';
         if (Max>=10000) and (Max <100000)then
            NOM:='00'+IntToStr(Position+1)+'. ';
         if (Max>=1000) and (Max<10000) then
            NOM:='0'+IntToStr(Position+1)+'. ';
         if Max<1000 then
            NOM:=IntToStr(Position+1)+'. ';
       end;
       if Length(IntToStr(Position+1))=4 then begin
         if Max>=100000 then
            NOM:='00'+IntToStr(Position+1)+'. ';
         if (Max>=10000) and (Max<100000) then
            NOM:='0'+IntToStr(Position+1)+'. ';
         if (Max>=1000) and (Max<10000) then
            NOM:=IntToStr(Position+1)+'. ';
       end;
       if Length(IntToStr(Position+1))=5 then begin
         if Max>=100000 then
          NOM:='0'+IntToStr(Position+1)+'. ';
       end;
       if Length(IntToStr(Position+1))=6 then begin
         if Max>=100000 then
            NOM:=IntToStr(Position+1)+'. ';
       end;
  Result := Nom;
end;
Robin W.
Ein Computer kann (fast) alles.... Man muss es ihm nur beibringen
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz