• (cs) in reply to Nagesh
    Nagesh fake:
    RS:
    Hey Nagesh is not the only one guilty of butchering the English language. I work with many WASPs and their use of the English language is not much better.
    Not understand. Wasp is insect meking nest in corner of my ofice. We are not being able to kil this leving creatures, even though I am geting stinged daily. :(

    WASP do not bite, faker!

  • (cs) in reply to Nagesh
    Nagesh:
    Nagesh:
    geoffrey is plain pagal - (crazy).

    java has created more value for business. java is not restricted to just business apps, but also used inside your car, your camera, your phone, your alarm clock and everywhere you can care to think of.

    So geoffrey is failing in providing any true picture of world.

    Here in Hyderabad, we use chicken for alarum clock.

    You must stay in slum outside Charminar. I am in Banjara Hills, madarchod!

  • Ben Jammin (unregistered) in reply to frits
    frits:
    A 'Brit':
    The British tic of critiquing American English is one of the many reasons I loathe British people on the internet.

    The American tic of loathing the English defending their language (notice that the Scots, Welsh and Irish won't defend it); and getting confused between Britain and the coutries that make it, is one of the many reasons I loathe Armerican people on the internet.

    The opinions of folks from a fallen empire which has shrunken to the size of the Philadelphia metro area do not interest me.

    Language is meant to communicate ideas. If those on the receiving end can interpret the original idea, then success.

    "From Cambridge University .

    Olny srmat poelpe can raed tihs. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, t he olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!"

    (What is scary is that my spell check only catches 3 words out of that mess.)

  • (cs)

    That mail in circulate since birth of internet. Tim Berner Lee write it!

  • Tim Berner Lee (unregistered) in reply to Nagesh

    Nagesh is right, I did.

    Captcha: nimis. My nimis Tim Berner Lee, I help Dan Quail invent the Internet, please to meet you.

  • Real Tim Berner Lee (unregistered) in reply to Tim Berner Lee
    FAKER Tim Berner Lee:
    Nagesh is right, I did.

    Captcha: nimis. My nimis Tim Berner Lee, I help Dan Quail invent the Internet, please to meet you.

    Faker!!

  • (cs) in reply to Ben Jammin
    Ben Jammin:
    Olny srmat poelpe can raed tihs.
    OMG THIS IS SO TRUE I OLWAYS NEW I WAS SMARTER THEN MY FRIENDS (lol i can read it i bet noone else can)).
    Ben Jammin:
    The phaonmneal pweor of the hmuan mnid
    How is identifying a rearranged set of letters "phaonmneal pweor"? I bet Babbage's analytical engine would have managed to do that.

    Sorry for the rant. Oh wait, this is TheDailyWTF, I don't have to apologize.

  • Jeff (unregistered) in reply to Strolskon
    Strolskon:
    Ben Jammin:
    Olny srmat poelpe can raed tihs.
    OMG THIS IS SO TRUE I OLWAYS NEW I WAS SMARTER THEN MY FRIENDS (lol i can read it i bet noone else can)).
    I can read it, but only because I've read it before, so I already know what it says.
  • Nagesh (unregistered) in reply to Nagesh
    Nagesh:
    Nagesh:
    Nagesh:
    geoffrey is plain pagal - (crazy).

    java has created more value for business. java is not restricted to just business apps, but also used inside your car, your camera, your phone, your alarm clock and everywhere you can care to think of.

    So geoffrey is failing in providing any true picture of world.

    Here in Hyderabad, we use chicken for alarum clock.

    You must stay in slum outside Charminar. I am in Banjara Hills, madarchod!

    All India is slum, excepting Goa. Do not believing what you see on TV.

  • (cs) in reply to Real Tim Berner Lee
    Real Tim Berner Lee:
    FAKER Tim Berner Lee:
    Nagesh is right, I did.

    Captcha: nimis. My nimis Tim Berner Lee, I help Dan Quail invent the Internet, please to meet you.

    Faker!!

    You are equal fake.

    Real Tim Berner Lee is not having time to post here, madarchod!

  • Tud (unregistered) in reply to Nagesh
    Fake Nagesh:
    Nagesh:
    Fake Nagesh:
    Nagesh:
    geoffrey is plain pagal - (crazy).

    java has created more value for business. java is not restricted to just business apps, but also used inside your car, your camera, your phone, your alarm clock and everywhere you can care to think of.

    So geoffrey is failing in providing any true picture of world.

    Here in Hyderabad, we use chicken for alarum clock.

    You must stay in slum outside Charminar. I am in Banjara Hills, madarchod!

    All India is slum, excepting Goa. Do not believing what you see on TV.

    Don't insult India Faker! And learn speaking English better! Do not is shorter and more compatible to say Don't.

  • Tud (unregistered)

    Now that was a real fail.

  • Remy Martin (unregistered)

    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed. This is especially hard on his widow, who is now forced to due both their taxes on her own to avoid an IRS penalty. Please keep her in your prayers.

  • Zunetang (unregistered) in reply to Remy Martin
    Remy Martin:
    I'm pleased to announce that I have some wonderful news. You've probably already guessed since there wasn't another tired, shitty article today, but Alex finally dropped dead. This is especially great news for his windows, which will no longer have to reflect his ugly face. Even the IRS doesn't missing out on his income taxes - the world is such a better place now. Please keep praying for him to wind up in hell. I, for one, am hoping he will suck Satan's cock for all eternity.
    Ding! Dong! - The faggot's dead! (Which old fag?) The Grecian fag! Ding, dong, the Grecian faggot's dead!

    Lot's 'a love, fuck face!!!

  • the (unregistered) in reply to Remy Martin
    Remy Martin:
    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed. This is especially hard on his widow, who is now forced to due both their taxes on her own to avoid an IRS penalty. Please keep her in your prayers.

    You must be new here. Alex frequently posts a lame wtf and then skips a day just to piss people off.

  • AGray (unregistered) in reply to Decius

    Best rewritten:

    If String.IsNullOrEmpty(p_mode) Then
      p_mode = "No parameter was passed through."
    End If
    

    The value of KISS is not lost on me. The engineering principle is pretty good, too.

  • AGray (unregistered) in reply to Decius

    Best rewritten:

    If String.IsNullOrEmpty(p_mode) Then
      p_mode = "No parameter was passed through."
    End If
    

    The value of KISS is not lost on me. The engineering principle is pretty good, too.

  • AGray (unregistered) in reply to AGray

    Better still:

    If String.IsNullOrEmpty(p_mode) Then Throw New ArgumentNullException("p_mode") End If

  • Ben Jammin (unregistered) in reply to the
    the:
    Remy Martin:
    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed. This is especially hard on his widow, who is now forced to due both their taxes on her own to avoid an IRS penalty. Please keep her in your prayers.

    You must be new here. Alex frequently posts a lame wtf and then skips a day just to piss people off.

    You must be new here. When Alex skips a day to piss people off, Remy notifies us that Alex has passed.

    P.S. When my Captcha is filled out by my browser's auto form filler... it is probably ineffective.

  • Saxton! (unregistered) in reply to Zunetang
    Zunetang:
    Remy Martin:
    I'm pleased to announce that I have some wonderful news. You've probably already guessed since there wasn't another tired, shitty article today, but Alex finally dropped dead. This is especially great news for his windows, which will no longer have to reflect his ugly face. Even the IRS doesn't missing out on his income taxes - the world is such a better place now. Please keep praying for him to wind up in hell. I, for one, am hoping he will suck Satan's cock for all eternity.
    Ding! Dong! - The faggot's dead! (Which old fag?) The Grecian fag! Ding, dong, the Grecian faggot's dead!

    Lot's 'a love, fuck face!!!

    Dude, relax.

  • the beholder (unregistered) in reply to Remy Martin
    Remy Martin:
    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed. This is especially hard on his widow, who is now forced to due both their taxes on her own to avoid an IRS penalty. Please keep her in your prayers.
    Oh we're not worried. You already said he died a few days ago, and then in the next day he got better.
  • Impatient Captcha wizard (unregistered) in reply to Ben Jammin
    Ben Jammin:
    the:
    Remy Martin:
    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed. This is especially hard on his widow, who is now forced to due both their taxes on her own to avoid an IRS penalty. Please keep her in your prayers.

    You must be new here. Alex frequently posts a lame wtf and then skips a day just to piss people off.

    You must be new here. When Alex skips a day to piss people off, Remy notifies us that Alex has passed.

    P.S. When my Captcha is filled out by my browser's auto form filler... it is probably ineffective.

    Doesn't matter. The captcha is just a minor deterrence. What actually prevents users from posting is Akismet.

    acsi aliquam amet aptent bene consequat cogo eros facilisis genitus gravis haero nimis mara oppeto opto paratus pecus populus plaga praesent quis saepius saluto tation tristique valetudo validus vereor verto vindico

    PS: I like the fact that when you hit "Preview" it generates a different one with the same word.

  • Real Advertiser (unregistered)

    If I was paying a newspaper to run my ads and they decided to put out an issue whenever they darn well felt like it, I'd immediately pull my ads and sue them for damages.

  • DirkAndTheMac (unregistered) in reply to configurator

    The bugs fixed were hysterical, the icing on a very splendid cake.... Somehow managed to misspell 'three' in the first iteration and whilst fixing that failed to notice that 5 would be 'four'..... Later on he even admits to having to shorten the name of the function from it's now concise name!!

  • (cs) in reply to Real Advertiser
    Real Advertiser:
    If I was paying a newspaper to run my ads and they decided to put out an issue whenever they darn well felt like it, I'd immediately pull my ads and sue them for damages.
    BFD. You're not paying Alex anything for his freely-provided work, and you think you have a right to complain? Grow up, weenie.
  • Friedrice The great (unregistered) in reply to RS
    RS:
    Hey Nagesh is not the only one guilty of butchering the English language. I work with many WASPs and their use of the English language is not much better.

    Weird Anti-Social Perverts?

  • (cs) in reply to Friedrice The great
    Friedrice The great:
    RS:
    Hey Nagesh is not the only one guilty of butchering the English language. I work with many WASPs and their use of the English language is not much better.

    Weird Anti-Social Perverts?

    I thought he was referring to a bunch of Blackie Lawlesses.

  • (cs) in reply to Nagesh
    Nagesh:
    Nagesh fake:
    Not understand. Wasp is insect meking nest in corner of my ofice. We are not being able to kil this leving creatures, even though I am geting stinged daily. :(

    WASP do not bite, faker!

    Sting != bite, fakir!

  • omfg (unregistered) in reply to KattMan

    13-19 becomes easy (nine) + (teen)

    threeteen fiveteen eightteen

    still better than "five" randomly printed for 4, though

  • North Shore Beach Bum (unregistered)

    In Hawai`i, we pronounce "3" the same as tree and rarely use plurals.

    Numbah tree day of Christmas, my tutu gave to me: tree dry squid, two coconut, and one myna bird in one papaya tree!
  • (cs) in reply to Cad Delworth
    Cad Delworth:
    For example, try asking for a "fanny pack" in a shop in England and see what you get (possibly including being thrown out of the shop!).

    Depending, of course, on the sort of shop!

  • (cs) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    Yeah, I remember ol' HX_373. He was THX_1138's granddad, ya know. And when he got to drinking, he would get as pissed as a parameter!

    <3

  • null (unregistered) in reply to Remy Martin
    Remy Martin:
    I'm sorry to announce that I have some bad news. You've probably already guessed since there was no article today, but Alex unexpectedly passed.

    Was a he passed as a perimeter? if (todaysWtf == null) return "No Alex was passed.";

    Captcha 'incassum' -- they should keep a couple of spare Wtf's laying around incassum Alex doesn't feel like posting on a given day.

  • Real Advertiser (unregistered) in reply to Silverhill
    Silverhill:
    Real Advertiser:
    If I was paying a newspaper to run my ads and they decided to put out an issue whenever they darn well felt like it, I'd immediately pull my ads and sue them for damages.
    BFD. You're not paying Alex anything for his freely-provided work, and you think you have a right to complain? Grow up, weenie.

    Oh...you must have the ads on the side blocked then.

    How does your foot taste?

  • TheSHEEEP (unregistered)

    Are you people nuts?

    "Tokyo & Beijing - see you at QCon (April 16-20) "

    I'm pretty sure this has SOMETHING to do with the absence of new articles...

  • erat (unregistered) in reply to Tasty
    Tasty:
    KattMan:
    Honestly it's a language parser, should be easy to do all numbers with little more code.

    Go 1-9, then 10-12, then 13-19 becomes easy (nine) + (teen) After that everything else is easy 21, 31 are (twenty) + (one) or (thirty) + (one).

    Yeah this function is a serious WTF, even in its name, sounds like the forgot to name it and just put the comment as the name.

    Never depend on logic when using natural languages!

    Your 13-19 range doesn't quite work. For example:

    three+teen != "thirteen" five+teen != "fifteen"

    Bonus Spanish language oddity: The "hundreds" in Spanish have an irregular 500.

    cien (100) dos cientos (200) tres cientos (300) ... quinentos (500) (the first N is N+~)

    Just for your information: 700 (setecientos / siete cientos) and 900 (novecientos / nueve cientos) are also irregular... just saying.

  • (cs)

    There's so many WTFs I don't know where to start.

        '***************************** Example Usage********************************************** 
    
        '       WORD_CONVERTED_FROM_A_NUMBER_PASSED_THROUGH_A_PERIMETER("pass_a_number","13,387,281")
        '       
        '       would return: thirteen million three hundred and eighty seven thousand two hundred and eighty one
    

    Except it only works for numbers up to 15, including "eleevn" and "forteen".

    I think I discovered why it's version 15.1 ... that's the range of numbers it actually works for !

    Future plans ... after the first 1000 it's going to get easier, so we can start using exponential upgrades ! Although memory is going to get a bit tight by 100 million, as it will take around 7GB just to store the code.

  • depressed cheescake (unregistered) in reply to Real Advertiser
    Real Advertiser:
    Silverhill:
    Real Advertiser:
    If I was paying a newspaper to run my ads and they decided to put out an issue whenever they darn well felt like it, I'd immediately pull my ads and sue them for damages.
    BFD. You're not paying Alex anything for his freely-provided work, and you think you have a right to complain? Grow up, weenie.

    Oh...you must have the ads on the side blocked then.

    How does your foot taste?

    Presumably you mean the Buildmaster ads from Inedo, you know the company Alex works for? Guess they're probably not too bothered.

    More to the point why do you give a shit about whether advertising revenue is well spent on this site?

  • bad_management (unregistered)

    Perimeter, parameter. Toe-may-toe, toe-mah-toe. Poe-tay-toe, poe-tah-toe.

  • Orwellian_Startrek (unregistered) in reply to wonk

    [quote user="wonk"][quote=Article] 'Sometimes a 'four' would be outputted when '5' was passed through the perimeter[/quote] NOW that episode of Star Trek makes sense. Heh. 4 lights....[/quote]

    Lights? Star Trek?

    You realize that that episode was a ripoff from 1984, right? (4 fingers)

  • Jay (unregistered) in reply to no
    no:
    Bleat:
    'API call removed due to high demand
    1) How much was this used that this was ever in 'high demand'

    Well, it never was defined what kind of 'high demand' - as in 'all his colleagues demanded that his hands be separated from his arms before being allowed near a computer again'

    Or, The only time people demand this function is when they are high on something.

  • Jay (unregistered) in reply to ozzie
    ozzie:
    mschaad:
    I just appreciated the fact that the English output is still wrong.

    [GrammarNazi] 13,387,281 rendered as words should read "thirteen million three hundred eighty-seven thousand two hundred eighty-one". Note that the word "and" is not in there at all, and tens are properly hyphenated. :-) [/GrammarNazi]

    Also, to render numbers correctly as words (with the hyphens and everything) is a harder trick than you might think. Thankfully, standard English style dictates that you pretty much never spell out any numbers above nine.

    So where would you need a library like this, unless your app writes checks?

    [SpellingNazi] You mean cheques? [/SpellingNazi]

    Captcha - opto - I opto point out your spelling mistakes while you point out grammar mistakes.

    Umm, maybe because he has an app that prints checks?

    RE SpellingNazi: No, that should be UKEnglishNazi. In real modern English, you know, US English, we spell it "checks".

  • Jay (unregistered) in reply to Ben Jammin
    Ben Jammin:
    frits:
    A 'Brit':
    The British tic of critiquing American English is one of the many reasons I loathe British people on the internet.

    The American tic of loathing the English defending their language (notice that the Scots, Welsh and Irish won't defend it); and getting confused between Britain and the coutries that make it, is one of the many reasons I loathe Armerican people on the internet.

    The opinions of folks from a fallen empire which has shrunken to the size of the Philadelphia metro area do not interest me.

    Language is meant to communicate ideas. If those on the receiving end can interpret the original idea, then success.

    "From Cambridge University .

    Olny srmat poelpe can raed tihs. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, t he olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!"

    (What is scary is that my spell check only catches 3 words out of that mess.)

    We do, however, give bonus points for making text easy to understand. If I write, "I went to the store", you can very quickly discern my meaning. If I write, "i wnet ot het tsoer", you may be able to figure it out, but it takes considerably longer. Likewise if I write, "I perambulated to the retail establishment", or any of other numerous senseless added obfuscations, you have to think for an extra second or two. My time is too valuable to waste on people who cannot express their thoughts clearly.

  • HotelBravoMike (unregistered) in reply to sirhegel

    Well, I took a shot at it:

    • my version can do German and English
    • the range is bigger than just 0 to 15
    • I spell 'eleven' (or 'Elf') correctly
    • use of global variables not really ideal
    • limited range (-210e9 to +210e9)

    I actually thought this was necessary due to a 32bit machine - however with TCL (everything is a string) this is not really a restriction. As long as I do not calculate with the so called integers. ;)

    I am not sure if the created german words are to be concatenated or separate. (Embarrasingly for native speake, I know.)

    For Example: the number 1,403,211 Eine Million Vierhundertdrei Tausend Zweihundertelf ... does not look right to me Einemillionvierhundertdreitausendzweihundertelf ... is not really very readable

    I decide to present the version which is more readable.

    If someone could give an educated opinion on that please.....

    So, code works in 2 parts:

    a) setup

    setup de or setup en

    ... declares 2 global varables called 'language' and 'numbers'

    b) conversion

    set text_representation [int2txt decimal_representation] e.g. puts [int2txt 123456789] --> onehundredtwentythree million, fourhundredfiftysix thousand, sevenhundredeightynine or Einhundertdreiundzwanzig Millionen Vierhundertsechsundfünfzig Tausend Siebenhundertneunundachtzig

    ## #
    ## # setup a language
    ## #
    
    proc setup {la} {
      global language numbers
      set language $la
      # remove existing configuration to prevent contamination
      if {[info exists numbers]} {unset numbers}
      # select from list of supported languages
      switch -exact -- $la {
        en {
          set numbers(0) zero
          set numbers(1to9) [list one two three four five six seven eight nine]
          set numbers(10to19) [list ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]
          set numbers(20to90) [list twenty thirty fourty fifty sixty seventy eighty ninety]
          set numbers(100) hundred
          set numbers(pow3) [list thousand million billion]
          set numbers(neg) minus
          set numbers(ovr) "over two billion"
          set numbers(undr) "less than minus two billion"
          # 3 digit partitioning, example: one million <AND> twohundred thousand <AND> twelve
          #set numbers(and) "and "
          set numbers(and) "\b, "
          #set numbers(and) ""
        }
        de {
          set numbers(0) Null
          set numbers(1) Eins
          set numbers(1to19) [list ein zwei drei vier fünf sechs sieben acht neun zehn \
                              elf zwölf dreizehn vierzehn fünfzehn sechzehn siebzehn achtzehn neunzehn]
          set numbers(20to90) [list zwanzig dreisig vierzig fünfzig sechzig siebzig achtzig neunzig]
          set numbers(100) hundert
          set numbers(pow3.0) [list tausend million milliarde]
          set numbers(pow3.1) [list tausend millionen milliarden]      
          set numbers(pow3.ending) [list s {} e e]
          set numbers(neg) Minus
          set numbers(ovr) "Über Zwei Milliarden"
          set numbers(undr) "Weniger als Minus Zwei Milliarden"
        }
        default {
          puts stderr "'$la' is not a supported language - please choose 'en' or 'de' - exiting."
          exit 1
        }
      }
      set numbers(upper) [expr (1 << 31) - 1]
      set numbers(lower) [expr (1 << 31)]
    }
    
    ## #
    ## # translate integer to text
    ## #
    
    # Note: in TCL everything is a string, so no explicit format %d conversion
    
    # integer into segments of 3 digits, empty string if segment is '000'
    proc to3digits {i} {
      set l [list ]
      set le [string length $i]
      # split into set of 3 digits each
      set n -1
      for {set p1 [expr $le-3]; set p2 [expr $le-1]} {$p2 >= 0} {incr p1 -3; incr p2 -3} {
        set s [string range $i $p1 $p2]
        regsub {^0+} $s "" s
        incr n; set di($n) $s
      }
      # reverse list
      for {} {$n >= 0} {incr n -1} {
        lappend l $di($n)
      }
      return $l
    }
    
    # german locale (de)
    proc 3digits2txt.de {d} {
      global numbers
      set s ""
      if {$d >= 100} {
        set hundreds [expr ($d/100)]
        set s [lindex $numbers(1to19) [expr $hundreds-1]]
        append s $numbers(100)
        set d [expr $d % 100]
      }
      if {$d == 0} {return $s}
      if {$d < 20} {
        append s [lindex $numbers(1to19) [expr ($d%20)-1]]
      } else {
        set tens [expr $d/10]
        set ones [expr $d%10]
        if {$ones > 0} {
          append s [lindex $numbers(1to19) [expr $ones-1]]
          append s und
        }
        append s [lindex $numbers(20to90) [expr $tens-2]]
      }
      return $s
    }
    proc int2txt.de {i} {
      global language numbers
      if {$i == 1} {return $numbers(1); return}
      set di [to3digits $i]
      set pow [llength $di]
      incr pow -1
      set txt ""
      foreach d $di {
        incr pow -1
        if {$d == {}} {continue}
        set s [3digits2txt.de $d]
        set plural 1
        if {[expr $d%100] == 1} {
          set plural 0
          append s [lindex $numbers(pow3.ending) [expr $pow+1]]
        }
        if {$pow >= 0} {
          append txt [format "%s %s " [string totitle $s] [string totitle [lindex $numbers(pow3.$plural) $pow]]]
        } else {
          append txt [format "%s " [string totitle $s]]
        }
      }
      return $txt
    }
    # english locale (en)
    proc 3digits2txt.en {d} {
      global numbers
      set s ""
      if {$d >= 100} {
        set hundreds [expr ($d/100)]
        set s [lindex $numbers(1to9) [expr $hundreds-1]]
        append s $numbers(100) 
        set d [expr $d % 100]    
      }
      if {$d == 0} {return $s}
      if {$d < 20} {
        if {$d < 10} {
          append s [lindex $numbers(1to9) [expr ($d%10)-1]]
        } else {
          append s [lindex $numbers(10to19) [expr ($d%20)-10]]
        }
      } else {
        append s [lindex $numbers(20to90) [expr ($d/10)-2]]
        append s [lindex $numbers(1to9) [expr ($d%10)-1]]
      } 
      return $s
    }
    
    proc int2txt.en {i} {
      global numbers
      set di [to3digits $i]
      set pow [llength $di]
      incr pow -1
      set and ""
      set txt ""
      foreach d $di {
        incr pow -1
        if {$d == {}} {continue}
        set s [3digits2txt.en $d]
        if {$pow >= 0} {
          append txt [format "%s%s %s " $and $s [lindex $numbers(pow3) $pow]]
        } else {
          append txt [format "%s%s " $and $s]
        }
        set and $numbers(and)
      }
      return $txt
    }
    
    # main converter (calls locale)
    
    proc int2txt {i} {
      global language numbers
      if {$i == 0} {puts -nonewline $numbers(0); return}
      if {$i < $numbers(lower)} {puts -nonewline $numbers(undr); return}
      if {$i > $numbers(upper)} {puts -nonewline $numbers(ovr); return}
      if {$i < 0} {
        set i [expr abs($i)]
        puts -nonewline [format "%s " $numbers(neg)]
      }
      int2txt.$language $i
    }
    
    

    Looks OK in preview so lets submit. ;)

  • HotelBravoMike (unregistered) in reply to HotelBravoMike

    Arghhh.. what a right mess-up on the main converter call. (The initial version printed directly to console instead of returning the string.)

    This should do the trick

    # main converter (calls locale)
    
    proc int2txt {i} {
      global language numbers
      if {$i == 0} {return $numbers(0)}
      if {$i < $numbers(lower)} {return $numbers(undr)}
      if {$i > $numbers(upper)} {return $numbers(ovr)}
      if {$i < 0} {
        set i [expr abs($i)]
        return [format "%s %s" $numbers(neg) [int2txt.$language $i]]
      }
      return [int2txt.$language $i]
    }
    
  • Dutchie (unregistered)

    Over at stackoverflow.com there are some nice solutions like this one.

  • Nemo (unregistered) in reply to Nemo

    I found my earlier version had some float/int problems with larger numbers, and I was taking the wrong field for the overall limit. So, version 2:

    http://pastebin.com/xq66a3H3

  • NRC (unregistered) in reply to Anon

    Looks like a novice programmer struggling with immutable strings. I wonder how many hours were spent trying to figure out why p_mode.Replace() did not actually replace the characters in that instance, before giving up (but still leaving the pointless code in there).

  • (cs) in reply to Silverhill
    Silverhill:
    zzo38:
    <snip> 5:twelve-th]:twelvth
    This was written on the Twelfth of Never, right?
    Oops! Thanks for notifying me this mistake, I will fix it
  • Acacio (unregistered)

    Wow, just wow. I've read a lot of stupid stuff in the DWTF but this one is just ... wow. In so many dimensions....

    We can close DWTF: after this one, all the rest will paleas watered down beer.

Leave a comment on “get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function”

Log In or post as a guest

Replying to comment #:

« Return to Article