Ask a Question related to PHP Development, Design and Development.
-
Matt Palermo #1
Insert leading zeros
I have a string of digits that looks like something like these: 0025,
1234, 0001, 1003, and so on. They are all 4 digits in length. Then
when I increment one of them by 1, I want to still have 4 digits for the
value (it should insert the leading zeros if needed). Is there any type
of function that will force the incremented value to be exactly 4 digits
no matter what number it increments? Please let me know if there is a
function that will insert these leading zeros or truncate it to 4 digits
if necessary. Thanks.
Matt
Matt Palermo Guest
-
Leading Zeros not being read from Excel Query
We are having an odd problem when trying to read in a query from Excel. What we are trying to do: We have a page where users will upload an Excel... -
Disappering leading zeros
Have a problem that has me swinging. I have a MS Access d/b that contains a zip code directory. Updates are done via a web-based ColdFusion form.... -
CSV file - Leading Zeros
Is there a way to write a CSV file so that excel wont drop the leading zero's from fields? I could use spreadsheet::writeexcel or OLE but that's... -
missing strip function in DB2 8.1 -- remove leading zeros
sujit <yhkumars@yahoo.com> wrote: Where did you have the STRIP function? It didn't exist in version 7.... -
CSV for Excel - Problem with Leading Zeros
Can we consider change the string to: ' 0000563' ? Luke (This posting is provided "AS IS", with no warranties, and confers no rights.) -
Curt Zirzow #2
Re: [PHP] Insert leading zeros
Matt Palermo <mpalermo@vt.edu> wrote:
$var = sprintf("%04d", $var+1);> I have a string of digits that looks like something like these: 0025,
> 1234, 0001, 1003, and so on. They are all 4 digits in length. Then
> when I increment one of them by 1, I want to still have 4 digits for the
> value (it should insert the leading zeros if needed). Is there any type
> of function that will force the incremented value to be exactly 4 digits
> no matter what number it increments? Please let me know if there is a
> function that will insert these leading zeros or truncate it to 4 digits
> if necessary. Thanks.
Curt
--
Curt Zirzow Guest
-
Matt Palermo #3
RE: [PHP] Insert leading zeros
Thanks a lot. It works like a charm!
-----Original Message-----
From: Curt Zirzow [mailto:curt@zirzow.dyndns.org]
Sent: Tuesday, July 15, 2003 8:45 PM
To: [email]php-general@lists.php.net[/email]
Subject: Re: [PHP] Insert leading zeros
Matt Palermo <mpalermo@vt.edu> wrote:the> I have a string of digits that looks like something like these: 0025,
> 1234, 0001, 1003, and so on. They are all 4 digits in length. Then
> when I increment one of them by 1, I want to still have 4 digits fortype> value (it should insert the leading zeros if needed). Is there anydigits> of function that will force the incremented value to be exactly 4digits> no matter what number it increments? Please let me know if there is a
> function that will insert these leading zeros or truncate it to 4$var = sprintf("%04d", $var+1);> if necessary. Thanks.
Curt
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Matt Palermo Guest



Reply With Quote

