[REBOL] Re: Uppercase/Lowercase
From: gjones05::mail::orion::org at: 19-May-2001 8:34
From: "Rondon Andrade"
> Does anybody has an script to make initials of phrases in Uppercase?
>
> str: "INFORMATION MANAGEMENT JOURNAL"
> return str
>
> probe str
> "Information Management Journal"
>
> because after that I can use a string with stopwords to change
articles,
> prepositions, etc.. using replace...
>
> Thanks in advance.
Hi, Rondon,
Here is a quick and dirty function I cooked up.
init-cap: func [in-str [string!] /local nstr][
nstr: copy ""
foreach s parse lowercase in-str none [
append nstr rejoin [ s/1: to-char uppercase to-string s/1 " "]
]
trim nstr
]
;===
;use like the following:
str: "INFORMATION MANAGEMENT JOURNAL"
str: init-cap str ; yields str set to "Information Management Journal"
Hope this helps.
--Scott Jones