← Back to team overview

widelands-dev team mailing list archive

Re: string formatting - integers + leading blanks

 

I cannot make it work. I tested couple of layouts. It even crashed the game.

At the end it is not that critical and perhaps once a branch will be
created somebody will be able to change it that way

Thanks

2014-11-21 12:10 GMT+01:00 Fòram na Gàidhlig <fios@xxxxxxxxxxxxxxxxxxx>:

> I think the problem might be that boost::format is interpreting the
> numbers as placehloder order. Try
>
> static boost::format node_format("(%1$3i, %2$3i; %3%2i)");
>
> If this doesn't solve your problem, you might find usage examples if you
> grep the code base for boost::format. Otherwise, google for the
> documentation. I know these can be a bit tricky.
>
> Also, we are trying to get rid of "using namespace" statements in the
> long run, so please use "boost::format" rather than just "format".
>
>
>
> 21/11/2014 10:25, sgrìobh Tibor Bamhor:
> > I am trying to use something like this:
> >
> > static format node_format("(%3i, %3i; %2i)");
> >
> > but these numbers are ignored. I noticed that similar code like this
> > '%5.1f' works, what should I use to make it work?
> >
> > Also '%03i' works as intended...
> >
> > Tibor
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~widelands-dev
> > Post to     : widelands-dev@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~widelands-dev
> > More help   : https://help.launchpad.net/ListHelp
> >
> >
> >
> > No virus found in this message.
> > Checked by AVG - www.avg.com <http://www.avg.com>
> > Version: 2015.0.5577 / Virus Database: 4213/8604 - Release Date: 11/21/14
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~widelands-dev
> Post to     : widelands-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~widelands-dev
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References