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
  1. Home
  2. General Programming
  3. C#
  4. number to alpha

number to alpha

Scheduled Pinned Locked Moved C#
questiontutorial
3 Posts 3 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.
  • B Offline
    B Offline
    boruu
    wrote on last edited by
    #1

    hi all, i'm trying converting numbers to alpha. for example if i write 30 it'll give me "thirty" or 31 - "thirtyone"... how can i do that?? thanx...

    K D 2 Replies Last reply
    0
    • B boruu

      hi all, i'm trying converting numbers to alpha. for example if i write 30 it'll give me "thirty" or 31 - "thirtyone"... how can i do that?? thanx...

      K Offline
      K Offline
      keith maddox
      wrote on last edited by
      #2

      Wow, that would not be too hard but would require more time to explain than I think most of us would be willing to put in, but if it's okay, let me get you started and I think you can figure the rest out on your own. seperate your problem into periods. A period is the three number grouping deliniating hundreds, thousands, millions .... ie 42,233,123 so this should convert to the string "fouty two million, two hundred thirty three thousand, one hundred twenty three" right? so now you have three strings : "42" , "233", "123" now take each of those strings and make a post-period-word for them to tack on later, so you'd have: "Million", "Thousand" Dont worry about the last string, that one will just be worded on its own. now convert the number in each of the strings and convert them into words. You can figure this out on your own and its not too hard but think carefully about it, there are some special cases here! This is kind of a recursive algorithm but there are a few special cases you'll need to code for like not wording the last group. For instance you would not want to save "One Hundred Twenty Three Hundred". Have fun.

      1 Reply Last reply
      0
      • B boruu

        hi all, i'm trying converting numbers to alpha. for example if i write 30 it'll give me "thirty" or 31 - "thirtyone"... how can i do that?? thanx...

        D Offline
        D Offline
        DavidNohejl
        wrote on last edited by
        #3

        Take a look at this article[^] :) David Never forget: "Stay kul and happy" (I.A.)
        David's thoughts / dnhsoftware.org / MyHTMLTidy

        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