← Back to team overview

widelands-dev team mailing list archive

Re: string formatting - integers + leading blanks

 

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
> 


Follow ups

References