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

    Join Date
    Apr 2000
    Rep Power
    How can I find out how many decimal places are in a string? If there is more than one decimal place then I want to reject the input.
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>if(preg_match("/.d{1}/", $variableName))
    // pass, do something
    // fail, reject input

    i haven't test the code above, so just let me know if it doesn't work and i'll make it work :-)

    [This message has been edited by RyanP (edited August 12, 2000).]

Similar Threads

  1. Specifying number of decimal places for output
    By CodE-E in forum PHP Development
    Replies: 6
    Last Post: March 4th, 2004, 11:28 AM
  2. Replies: 0
    Last Post: November 12th, 2003, 09:20 AM
  3. Web form field decimal places
    By jwpearson in forum HTML Programming
    Replies: 3
    Last Post: November 11th, 2003, 04:06 PM
  4. Variable number of decimal places
    By pozter in forum PHP Development
    Replies: 14
    Last Post: May 2nd, 2003, 11:26 PM
  5. No. of decimal places for float type
    By OB_redemption in forum Perl Programming
    Replies: 3
    Last Post: October 5th, 2002, 12:55 AM

IMN logo majestic logo threadwatch logo seochat tools logo