[Prev][Next][Index][Thread]

# Re: Two Text-String Questions

- Date: Thu, 28 Sep 1995 09:07:10 PDT
- From:
- Content-Length: 1058
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=US-ASCII
- In-Reply-To: <Pine.LNX.3.91.950928232856.10045A-100000@iman.internet.co.nz> from "Ian Macintosh" at Sep 28, 95 04:40:16 am

    Ian Macintosh scribbles :
    #
    #
    #On Wed, 27 Sep 1995, James Renken wrote:
    #
    #> 1. How can I convert a number into words?  (For example, 94,000 into
    #> "ninety-four thousand")

    Use the $string_utils:english_number(string) function.

    ;$string_utils:english_number(94000";
    => "ninety-four thousand"

    ;$string_utils:english_number(-1);
    => "negative one"

    #I think there is a function that already does this.  If you don't find
    #it, wait a bit, as someone will undoubtably reply to this message with
    #the exact function :^)

    Couldn't resist ...

    #> 2. How can I remove certain text from a string?  (For example, "SOMETHING.html"
    #> into "SOMETHING")
    #
    #Use the strsub function.
    #
    #strsub("SOMETHING.html", ".html", "")    ->   "SOMETHING"

    But, if you know something about the string you have to chop,
    you can simply use array operations (that might be faster in certain conditions)

    fullname = "Panino.html";
    l = length (fullname);
    shortname = fullname[1..l-5];
    extensione = fullname[l-3..l];

    I hope I haven't said anything terribly wrong.

    Omaggi, Walter

References:

- Re: Two Text-String Questions

- From: Ian Macintosh <ian@iman.internet.co.nz>

- Prev: Re: Two Text-String Questions
- Next: USR1 signal
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index