shifting integers

I have a inputfield with a character limit of 4. Numbers only, 3 digits and 1 for minus sign. If a user enters a number that is less than 3 digits, I should have something that adds 0’s to the left of that number. Anyone got a clue on how to do that?

Hi, if you are using strings for your input / display and you are parsing you could use string.Format to pad with zeros. Otherwise you can use an equation like Math.Floor(Math.Log10(n) + 1); to get the number of digits in an int. Of course you can use myInt.ToString().Length to get the number of characters and check if the number is negative and remove the sign. As @BoredMormon has already suggested a code snippet could help direct our input. Hope that helps =D