#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    5
    Rep Power
    0
    Does anyone know of an existing function that would strip off all initial zeros from a string? I have a MySQL db with 4 zero filled fields. I would like to show just the base number in the results of my query. i.e. I currently get 003 and 0049 and would like 3 and 49.

    Thank you,

    ------------------
    bj

    [This message has been edited by bjohnson (edited April 20, 2000).]
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    5
    Rep Power
    0
    Somebody told me to use:<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    $nozeros = sprintf("%01d", $chapter);
    [/code]
    It works, but I was wondering if that is the best approach. I now get 3 instead of 00003.

IMN logo majestic logo threadwatch logo seochat tools logo