Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Compare 2 digits

Compare 2 digits

Scheduled Pinned Locked Moved C#
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cppdotnet
    wrote on last edited by
    #1

    I have this weird comparision to do. Any idea or suggestions are really appreciated one decimal digit will be like 900.0 where 9 means optional and 0 means Required. and 2nd # will be 88.8 which I have to compare and say it's valid because decimal is required 2 digit on left are required and one digit on right .. so what ever is required are there. 8888.88 is not valid since 3rd digit is optional but cannot have more than that. 1.8 is not valid since at least 2 digit on left and one on right are required. Thanks

    G 1 Reply Last reply
    0
    • C cppdotnet

      I have this weird comparision to do. Any idea or suggestions are really appreciated one decimal digit will be like 900.0 where 9 means optional and 0 means Required. and 2nd # will be 88.8 which I have to compare and say it's valid because decimal is required 2 digit on left are required and one digit on right .. so what ever is required are there. 8888.88 is not valid since 3rd digit is optional but cannot have more than that. 1.8 is not valid since at least 2 digit on left and one on right are required. Thanks

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use a Regex object with the pattern "^\d{2,3}\.\d$" to verify the value. --- b { font-weight: normal; }

      C 1 Reply Last reply
      0
      • G Guffa

        Use a Regex object with the pattern "^\d{2,3}\.\d$" to verify the value. --- b { font-weight: normal; }

        C Offline
        C Offline
        cppdotnet
        wrote on last edited by
        #3

        Thanks and sorry. Thanks for your help amd sorry i didn't get it. Thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups