Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Formatanweisung pimpen (https://www.delphipraxis.net/188367-formatanweisung-pimpen.html)

haentschman 25. Feb 2016 07:05

Delphi-Version: XE

Formatanweisung pimpen
 
Moin... :P

Heute lasse ich euch mal für mich denken... 8-)

Gegeben:
Formatbefehl normal:
Delphi-Quellcode:
Format("Bla %d blubb %d...", [1,1]);
Wunsch:
Da alle %d Werte den gleichen Wert repräsentieren sollen wäre
Delphi-Quellcode:
Format("Bla %d blubb %d...", [1]);
(o.ä.) eine Wunschvorstellung ähnlich wie bei Batchdateien (%1 usw.)

Welche Tricks kenne ich noch nicht?

Hintergrund:
Ausfüllen eines SQL Scriptes mit gleichen %s Werten. (Tabellenname)


Danke...:P

vagtler 25. Feb 2016 07:07

AW: Formatanweisung pimpen
 
Format kennt eine Indizierung der Parameter.

http://www.delphibasics.co.uk/RTL.asp?Name=format

EgonHugeist 25. Feb 2016 07:08

AW: Formatanweisung pimpen
 
Da du scheinbar immer gleiche Werte willst:

Was ist mit StringReplace() ?

haentschman 25. Feb 2016 07:17

AW: Formatanweisung pimpen
 
Zitat:

Was ist mit StringReplace() ?
...ja was ist damit. Gut ist das. :wink: Na logisch. Eindeutig ein Koffeinmangelproblem. :P

vagtler 25. Feb 2016 07:29

AW: Formatanweisung pimpen
 
StringReplace ist ein sehr eingeschränkter Ersatz für Format.

baumina 25. Feb 2016 07:37

AW: Formatanweisung pimpen
 
Delphi-Quellcode:
Format("Bla %0:d blubb %0:d...", [1]);

haentschman 25. Feb 2016 07:47

AW: Formatanweisung pimpen
 
:cheer: Noch besser. Dann ist das ja wie in der Batchdatei.
Delphi-Quellcode:
Format('Bla %0:s Blubb %1:d', ['Blubbchen', 1])
geht auch.

Again what learned... :stupid:

Danke.

vagtler 25. Feb 2016 07:48

AW: Formatanweisung pimpen
 
Schrieb ich doch oben schon?!? http://www.delphipraxis.net/1331280-post2.html

haentschman 25. Feb 2016 07:51

AW: Formatanweisung pimpen
 
:oops: Ist es schlimm wenn ich dich ignoriert habe... Sorry. :cheers:

EgonHugeist 25. Feb 2016 08:14

AW: Formatanweisung pimpen
 
Darf man fragen, was du unter "pimpen" verstehst? Worum genau geht es dir dabei genau?


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:20 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz