What is the WPF XAML Data Binding equivalent of String.Format?

You can use MultiBinding + StringFormat (requires WPF 3.5 SP1): <TextBox.Text> <MultiBinding StringFormat=”{}{1:#0}% up, {2:#0}% down”> <Binding Path=”PercentageOne” /> <Binding Path=”PercentageTwo”/> </MultiBinding> </TextBox.Text> Regarding Run.Text – you can’t bind to it but there are some workarounds: http://fortes.com/2007/03/20/bindablerun/ http://paulstovell.net/blog/index.php/attached-bindablerun/

Printing with “\t” (tabs) does not result in aligned columns

Building on this question, I use the following code to indent my messages: String prefix1 = “short text:”; String prefix2 = “looooooooooooooong text:”; String msg = “indented”; /* * The second string begins after 40 characters. The dash means that the * first string is left-justified. */ String format = “%-40s%s%n”; System.out.printf(format, prefix1, msg); System.out.printf(format, … Read more

Use a custom thousand separator in C#

I suggest you find a NumberFormatInfo which most closely matches what you want (i.e. it’s right apart from the thousands separator), call Clone() on it and then set the NumberGroupSeparator property. (If you’re going to format the numbers using currency formats, you need to change CurrencyGroupSeparator instead/as well.) Use that as the format info for … Read more

How to output numbers with leading zeros in JavaScript? [duplicate]

NOTE: Potentially outdated. ECMAScript 2017 includes String.prototype.padStart. You’ll have to convert the number to a string since numbers don’t make sense with leading zeros. Something like this: function pad(num, size) { num = num.toString(); while (num.length < size) num = “0” + num; return num; } Or, if you know you’d never be using more … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)