MOO-cows Mailing List Archive
Re: Two Text-String Questions
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.
=> "ninety-four thousand"
=> "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.
Subject Index |