Re: String to Integer

From: Akuma/Chris Baggett/DOOMer (doomer@BAYOU.COM)
Date: 09/30/97


>Date: Wed, 01 Oct 1997 00:32:18 -0500
>To: Sammy <samedi@dhc.net>
>From: Akuma/Chris Baggett/DOOMer <doomer@bayou.com>
>Subject: Re:  String to Integer
>In-Reply-To: <Pine.LNX.3.96.970930223253.123A-100000@silly.dhc.net>
>References: <Pine.SOL.3.91.971001091139.5147B-100000@lux.levels.unisa.edu.au>
>
>>> The easiest way to convert a string to an integer is to use atoi or atol.
>>> aoti converts to integer, atol converts to a long integer.
>>
>>Hmmmm...
>>
>>atoi("Samedi") = 0
>>atoi("Archangel") = 0
>>atoi("Anybody") = 0
>>
>>atoi doesn't convert alphabetic strings to anything but 0, which wouldn't
>>be very useful for this application.
>
>  he IS correct in this :-)
>
>atoi() and atol() just convert numeric strings,
>such as
>"123" = 123
>"123798" = 123798
>heh, speaking of this, has anyone implemented a way to convert
>a  , separated number to an integer/long?
>like
>
>aCtoi("1,234,567") = 1234567
>^^^^^--  _a_lphabetic _C_omma-separated _to_ _i_nteger :-)
>
>if not, i may just write one for the fun of it :-P
>
>Code On
>Akuma the Raging Coder
>
  +------------------------------------------------------------+
  | "The poets talk about love, but what I talk about is DOOM, |
  |      because in the end, DOOM is all that counts." -       |
  |   Alex Machine/George Stark/Stephen King, The Dark Half    |
  |        "Nothing is IMPOSSIBLE, Just IMPROBABLE"            |
  |   "Easier Said Than Done, But Better Done Than Said..."    |
  +------------------------------------------------------------+


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST