Re: Strings in 4GL
Posted in 1998
Jonathan Leffler — — source: Informix-list mailing list archive (1991-1998)
On Mon, 8 Jun 1998, Sadagopan, Sathish wrote: > Using 4GL , I tried to access an array using subscripts and assign a blank > to them , > > main > define var1,ans char(10) > define i , j ,k smallint > let var1 = "ab" > let i = length(var1) > for j = i+1 to 10 > let var1[j]=" " > end for > let k=length(var1) > prompt k for ans > > end main > > K is 2 and not 10 , why ? Is it not possible to assign blank spaces ? Yes, you can assign to them. But the definition of LENGTH() is that it returns the length of a string ignoring any trailing blanks. Wrong tool for the job (or too much C programming -- LENGTH() is not strlen()). Yours, Jonathan Leffler (johnl@informix.com) #include <witticism.h>