|
>Date: Thu, 20 Dec 2001 10:13:21 -0600 (CST) >From: Scott Klement <klemscot@klements.com> > >Here's a quick one I wrote (in the last 3 minutes) that will do what >you're asking: > > P NoBlanks B > D NoBlanks PI 32766A varying > D Input 32766A const varying > D Output S 256A varying > D X S 10I 0 > c eval %len(Output) = 0 > c for x = 1 to %len(Input) > c if %subst(Input:X:1)<>' ' > c eval output = output + %subst(Input:X:1) > c endif > c endfor > c return output > P E Scott, you beat me to it. I looked at the scan and replace suggestions and thought a %subst and concatenate to a varying string would be better. It is - it performs 5 times faster than Mel's %scan/%replace method. But only if the string being built up is varying. Concatenation to the end of a varying string is very fast. Using %replace over and over requires a lot of extra copying of data. Barbara Morris
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.