Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!uupsi!sunic!liuida!mailhost!ug From: ug@linkoping.telesoft.se (Ulf G|ransson) Newsgroups: comp.lang.rexx Subject: Re: looking at individual characters in a string Message-ID: <732@castor.linkoping.telesoft.se> Date: 11 Feb 91 09:53:34 GMT References: <91039.085930GIAMPAL@auvm.auvm.edu> Organization: TeleSoft AB, Linkoping, Sweden Lines: 31 In article <91039.085930GIAMPAL@auvm.auvm.edu> GIAMPAL@auvm.auvm.edu writes: >that are contained in a Rexx string. Suppose I do : > > parse pull mystring > >Then I want to see individual characters in mystring. I know I could >use the index() function or substr(), but that seems wasteful, not to >mention slow. You could use the splitting capabilities of the PARSE instruction. If you just want to see each character from left to right, the following example could be used: tmp=mystring do i=1 until tmp='' parse var tmp char +1 tmp say 'Character #'i 'is "'char'"' end You could also pick out individual characters in the middle of the string, using something like: i=7 parse var mystring =i +1 but then I would rather use SUBSTR. -- Ulf Goransson, Telesoft Europe AB (ug@linkoping.telesoft.se) And now for something completely different.