On Monday, July 15, 2013, Bennie Kloosteman wrote: > Note C# does have format strings it uses {0} , {1} for the params since > the compile knows the type anyway ...seems a lotr smarter to me... when you > want to do more extensive format these days you have to take linguistic > formats it to account anyway ( yen with 2 decimal points looks stupid...so > then you need something much more complicated anyway. >
For the record C# style format strings support per item formatting and alignment. The form is: {index[,alignment][:formatString]} To print a price right aligned and padded with spaces to 10 characters you could do String.Format("Price {0,10:$#.##}", price). String.Format actually calls item.ToString(String format, IFormatProvider cultureInfo) for each substitution before applying padding and alignment. In this way the formatter can be easily taught how to format user defined types. You can find this detailed on msdn here: http://msdn.microsoft.com/en-us/library/txafckwd.aspx Steven
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev