Re: String concatenation in OnLine stored procedure - REPOSTED
Posted in 1997
In article <870241526snz@kontron.demon.co.uk>, andy@kontron.demon.co.uk wrote: > > Thanks for everyones replies, however, I have no TRIM() function > available within OnLine 5, unless it's called something else. > I also seem to be stumped because I can't put any sort of variable > into a substring specification, so str[1,LENGTH(str)] constructs aren't > possible either. > I seem to be stuck with: > i = LENGTH(str1) > IF i = 1 THEN > str1 = str1[1,1] || str2 > ELIF i = 2 THEN > str1 = str1[1,2] || str2 > ELIF i = 3 THEN > str1 = str1[1,3] || str2 > etc... > Ho Hum. > ... You could also try something like this: let str3 = '' let len = length(str1); for i = 1 to len let str3 = str1[1,1] || str3; let str1 = str1[2,255]; end for -- str3 should now be str1 in reverse, and can -- be concatenated in reverse to str2. for i = 1 to len let str2 = str3[1,1] || str2; let str3 = str3[2,255]; end for This will put the concatenated result into str2. I haven't tried this algorithm so it might need some adjustments but the basic idea should work. It's similar to the "upper" stored procedure that has been posted before. When we can upgrade to just basic features of Universal Server (at acceptable prices), this kind of tinkering will be unnecessary. ---------------------------------------------------------------------- John H. Frantz Power-4gl: Extending Informix-4gl frantz@centrum.is http://www.rl.is/~john/pow4gl.html -------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet