zeroes

Regex to add padding zeroes

I am working on this yahoo pipe Regex and I found a bug I'm unable to wrap my mind around it. I have a URL, from which I extract digits, cat them and make a img html tag and embed it. The issue is that, the URL is presented in a non padded way, but the image linked has the zeroes. Therefore, when there is a day or a month with single di...

Algorithms to trim leading zeroes from a SQL field?

I just came across the interesting problem of trying to trim the leading zeroes from a non-numeric field in SQL. (Since it can contain characters, it can't just be converted to a number and then back.) This is what we ended up using: SELECT REPLACE(LTRIM(REPLACE(fieldWithLeadingZeroes,'0',' ')),' ','0') It replaces the zeroes with sp...

MySQL 5.1.41 leading zero is deleted

Hello, I have a MySQL database where i want to store phonenumbers among other things. The fieldtype is INT(10) When I try to insert a number starting with a 0, like 0504042858 it's stored like 504042858. This only happens with zeros when the number start with any other number it's stored correctly. What am I doing wrong? ...

Why does gzip/deflate compressing a small file result in many trailing zeroes?

I'm using the following code to compress a small (~4kB) HTML file in C#. byte[] fileBuffer = ReadFully(inFile, ResponsePacket.maxResponsePayloadLength); // Read the entire requested HTML file into a memory buffer inFile.Close(); // Close the requested HTML file byte[] payl...

Trim any zeros at the beginning of a string using PHP

Users will be filling a field in with numbers relating to their account. Unfortunately some users will have zeroes prefixed to the beginning of the number to make up a six digit number (e.g. 000123, 001234) and others won't (e.g. 123, 1234). I want to 'trim' the numbers from users that have been prefixed with zeros in front so if a use...