SQLite function to format numbers with leading zeroes?

This can be accomplished with a little bit of magic using string concatenation and the substr function. Long story short, here’s what you want: select substr(‘0000000000’||’1234′, -10, 10) An explanation follows. First, know that SQLite’s string concatenation operator is ||. We’ll start by taking a string that is as long as the value we want … Read more

What’s the deal with char.GetNumericValue?

Remember that it’s taking a Unicode character and returning a value. ‘0’ through ‘9’ are the standard decimal digits, however there are other Unicode characters that represent numbers, some of which are floating point. Like this character: ¼ Console.WriteLine( char.GetNumericValue( ‘¼’ ) ); Outputs 0.25 in the console window.

How to properly format currency on ios

You probably want something like this (assuming currency is a float): NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle: NSNumberFormatterCurrencyStyle]; NSString *numberAsString = [numberFormatter stringFromNumber:[NSNumber numberWithFloat:currency]]; From your requirements to treat 52 as .52 you may need to divide by 100.0. The nice thing about this approach is that it will respect the current locale. … Read more

VB.net Need Text Box to Only Accept Numbers

You can do this with the use of Ascii integers. Put this code in the Textbox’s Keypress event. e.KeyChar represents the key that’s pressed. And the the built-in function Asc() converts it into its Ascii integer. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress ’97 – 122 = Ascii codes for … Read more