Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-66115

Let (QString|QLocale)::toFloat ignore trailing non-digits

XMLWordPrintable

    • 8

      The C standard library function atof() works like QString::toFloat for char arrays.

      In contrast to QString::toFloat(), atof() ignores e.g. a trailing unit after the float representation:

      "The rest of the string after the last valid character is ignored and has no effect on the behavior of this function." http://www.cplusplus.com/reference/cstdlib/atof/

      It would be nice, to be able to use QString("1.2345 V").toFloat() also. Currently it returns 0.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mmutz Marc Mutz
            aha_1980 André Hartmann
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes