I want the following code to remove a leading zero from a price (0.00 should be cut to .00)
QString price1 = "0.00";
if( price1.at( 0 ) == "0" ) price1.remove( 0 );
This gives me the following error: “error: conversion from ‘const char [2]’ to ‘QChar’ is ambiguous”
The main issue is that Qt is seeing
"0"as a null-terminated ASCII string, hence the compiler message aboutconst char[2].Also,
QString::remove()takes two arguments. So you code should be:This builds and runs on my system (Qt 4.7.3, VS2005).