Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > de.comp.lang.php > #4858

Re: (s)printf max width

From Andreas Neumann <an5275@sedo.com>
Newsgroups de.comp.lang.php
Subject Re: (s)printf max width
Date 2022-09-17 17:15 +0200
Organization Aioe.org NNTP Server
Message-ID <tg4oao$f1s$1@gioia.aioe.org> (permalink)
References <tg4j8i$op8$1@gioia.aioe.org> <jom3vbFu2kvU1@mid.individual.net>

Show all headers | View raw


Claus Reibenstein wrote:

> 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.

Tatsächlich. Vielen Dank!

Back to de.comp.lang.php | Previous | NextPrevious in thread | Find similar


Thread

(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