Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: uppercase two letters?

From: greggirwin:mindspring at: 25-Apr-2003 17:01

Hi Tom, TF> you wouldn't believe how ugly my attempts at this have been! TF> all I want to do is squash a sentence, then make the first and third TF> letters uppercase. Well, let's see, we could start by writing a function to handle the general case, like so: uppercase-at: func [ "Changes the letters at the specified positions to uppercase" string positions [any-block!] ] [ foreach pos positions [ poke string pos to char! uppercase to string! pick string pos ] ] Then use it like this:
>> s: copy "this is a line"
== "this is a line"
>> uppercase-at replace/all s " " "" [1 3]
Does that work for you? -- Gregg