Re: anomaly of length function for varchar
Mike Aubury <[email protected]> Sun, 19 Feb 2023 08:50:38 +0000
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CAGAq4WFXjpgbJ4JLUWELkdAsHy7keRwv_C_GaQsbDCDeYSiFdw@mail.gmail.com> |
--===============7869742286554873424== Content-Type: multipart/alternative; boundary="000000000000a8d79b05f509a491" --000000000000a8d79b05f509a491 Content-Type: text/plain; charset="UTF-8" There is an explicit "trim" in the code for LENGTH, Informix4gl reports 1 for the LENGTH too.. On Sun, 19 Feb 2023 at 01:55, Iwan AB <[email protected]> wrote: > Dear Aubit4GL team, > > I found anomaly of length function for varchar variable. > > Consider the following program > > MAIN > DEFINE w_str VARCHAR(5) > DEFINE n SMALLINT > > LET w_str = "x " > LET n = LENGTH(w_str) > DISPLAY "1. w_str=", w_str, "; => n=", n > > CODE > n = strlen(w_str); > ENDCODE > DISPLAY "2. w_str=", w_str, "; => n=", n > > END MAIN > it returns: > 1. w_str=x ; => n= 1 > 2. w_str=x ; => n= 3 > > Best regards, > > Iwan > > _______________________________________________ > Aubit4gl-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > --000000000000a8d79b05f509a491 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">There is an explicit "trim" in the code for LENG= TH, Informix4gl=C2=A0reports 1 for the LENGTH too..</div><br><div class=3D"= gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, 19 Feb 2023 at 0= 1:55, Iwan AB <<a href=3D"mailto:[email protected]">[email protected]</a>&= gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0= px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div = dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><font face=3D"monospace" size= =3D"4">Dear Aubit4GL team,</font><div><font face=3D"monospace" size=3D"4"><= br></font></div><div><font face=3D"monospace" size=3D"4">I found anomaly of= length function for varchar variable.</font></div><div><font face=3D"monos= pace" size=3D"4"><br></font></div><div><font face=3D"monospace" size=3D"4">= Consider the following program</font></div><div><font size=3D"4"><br></font= ></div><div><div><font face=3D"monospace" size=3D"4">MAIN</font></div><div>= <font face=3D"monospace" size=3D"4">=C2=A0 =C2=A0 DEFINE=C2=A0 w_str VARCHA= R(5)</font></div><div><font face=3D"monospace" size=3D"4">=C2=A0 =C2=A0 DEF= INE=C2=A0 n SMALLINT</font></div><div><font face=3D"monospace" size=3D"4"><= br></font></div><div><font face=3D"monospace" size=3D"4">=C2=A0 =C2=A0 LET = w_str =3D "x=C2=A0 "</font></div><div><font face=3D"monospace" si= ze=3D"4">=C2=A0 =C2=A0 LET n =3D LENGTH(w_str)</font></div><div><font face= =3D"monospace" size=3D"4">=C2=A0 =C2=A0 DISPLAY "1. w_str=3D", w_= str, "; =3D> n=3D", n</font></div><div><font face=3D"monospace= " size=3D"4"><br></font></div><div><font face=3D"monospace" size=3D"4">CODE= </font></div><div><font face=3D"monospace" size=3D"4">=C2=A0 =C2=A0 n =3D s= trlen(w_str);</font></div><div><font face=3D"monospace" size=3D"4">ENDCODE<= /font></div><div><font face=3D"monospace" size=3D"4">=C2=A0 =C2=A0 DISPLAY = "2. w_str=3D", w_str, "; =3D> n=3D", n</font></div><= div><font face=3D"monospace" size=3D"4"><br></font></div><div><font face=3D= "monospace" size=3D"4">END MAIN</font></div></div><div><font face=3D"monosp= ace" size=3D"4">it returns:</font></div><div><div><font face=3D"monospace" = size=3D"4">1. w_str=3Dx=C2=A0 ; =3D> n=3D=C2=A0 =C2=A0 =C2=A01</font></d= iv><div><font face=3D"monospace" size=3D"4">2. w_str=3Dx=C2=A0 ; =3D> n= =3D=C2=A0 =C2=A0 =C2=A03</font></div></div><div><font face=3D"monospace" si= ze=3D"4"><br></font></div><div><font face=3D"monospace" size=3D"4">Best=C2= =A0regards,</font></div><div><font face=3D"monospace" size=3D"4"><br></font= ></div><div><font face=3D"monospace" size=3D"4">Iwan</font></div><div><br><= /div></div></div></div> _______________________________________________<br> Aubit4gl-discuss mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank"= >[email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss" r= el=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/lis= tinfo/aubit4gl-discuss</a><br> </blockquote></div> --000000000000a8d79b05f509a491-- --===============7869742286554873424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============7869742286554873424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Aubit4gl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss --===============7869742286554873424==--