Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.php > #4856
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Claus Reibenstein <creibens@gmail.com> |
| Newsgroups | de.comp.lang.php |
| Subject | Re: (s)printf max width |
| Date | Sat, 17 Sep 2022 16:30:03 +0200 |
| Lines | 16 |
| Message-ID | <jom3vbFu2kvU1@mid.individual.net> (permalink) |
| References | <tg4j8i$op8$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net A2K7nO1YhhyxjWtO9mHL/AJc4aLEQgzRZe7H38z/htXlIu1dc= |
| Cancel-Lock | sha1:apz8wS0FZIjtzt2k89EPctIthrk= |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 SeaMonkey/2.53.13 |
| In-Reply-To | <tg4j8i$op8$1@gioia.aioe.org> |
| Xref | csiph.com de.comp.lang.php:4856 |
Show key headers only | View raw
Andreas Neumann schrieb am 17.09.2022 um 15:49: > [(s)printf] > > Meine Aufgabenstellung: Die floating-point number bewegt sich zwischen 0 und > 99. Für Zahlen <10 möchte ich eine Ausgabe von z.B. "7.2", für >=10 möchte > ich eine Ausgabe ohne Dezimalstellen, z.B "24". In beiden Fällen also mit > nicht mehr als 2 Stellen. "%.2g" sollte genau das tun, was Du suchst. Weitere Details zum Format-String findest Du z.B. unter <https://www.php.net/manual/en/function.printf.php>. Gruß Claus
Back to de.comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar
(s)printf max width Andreas Neumann <an5275@sedo.com> - 2022-09-17 15:49 +0200
Re: (s)printf max width Claus Reibenstein <creibens@gmail.com> - 2022-09-17 16:30 +0200
Re: (s)printf max width Claus Reibenstein <creibens@gmail.com> - 2022-09-17 16:47 +0200
Re: (s)printf max width Andreas Neumann <an5275@sedo.com> - 2022-09-17 17:15 +0200
csiph-web