Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!SOPHIST.UCHICAGO.EDU!goer From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) Newsgroups: comp.lang.icon Subject: (none) Message-ID: <8909160045.AA08151@sophist.uchicago.edu> Date: 16 Sep 89 00:45:56 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 29 The problem with the uppercasing procedure just submitted by Dave Cargo boils down to a slight error in subscripting no- tation. The plus sign needs to go before the colon; otherwise it is interpreted as a prefix operator creating a positive in- teger (that integer here being starsstr). pline2[i:+starsstr] := uline[i:+starsstr] #### the correct way of saying this is str[i+:j] #### pline3[i:+starsstr] := upper #### ditto #### This i:j stuff, though, is very un-iconish. But then I'm biased. String scanning can get to be a kind of religion: procedure main() sstr := "cargo" line := "cargo, dave cargo" write(capline(sstr,line)) end procedure capline(word,line) line2 := "" line ? { while line2 ||:= tab(find(word)) do line2 ||:= map(=word,&lcase,&ucase) line2 ||:= tab(0) } return line2 end