Re: anomaly of length function for varchar
Iwan AB <[email protected]> Sun, 19 Feb 2023 17:30:53 +0700
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CAHJCSmJbNwpYBqH+DLi=GH_E22Ong6YvMVRM7MV5QXKeyx6CSA@mail.gmail.com> |
--===============7085502857674999419== Content-Type: multipart/alternative; boundary="0000000000002f72e805f50b0bf4" --0000000000002f72e805f50b0bf4 Content-Type: text/plain; charset="UTF-8" Got it, thanks! On Sun, Feb 19, 2023 at 3:50 PM Mike Aubury <[email protected]> wrote: > 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 >> > --0000000000002f72e805f50b0bf4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Got it, thanks!=C2=A0<br></div><br><div class=3D"gmail_quo= te"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Feb 19, 2023 at 3:50 PM M= ike Aubury <<a href=3D"mailto:[email protected]">[email protected]</a>> wro= te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px = 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"= ltr">There is an explicit "trim" in the code for LENGTH, Informix= 4gl=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 01:55, Iwan A= B <<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= m</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin= :0px 0px 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 an= omaly of length function for varchar variable.</font></div><div><font face= =3D"monospace" size=3D"4"><br></font></div><div><font face=3D"monospace" si= ze=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_s= tr VARCHAR(5)</font></div><div><font face=3D"monospace" size=3D"4">=C2=A0 = =C2=A0 DEFINE=C2=A0 n SMALLINT</font></div><div><font face=3D"monospace" si= ze=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"mo= nospace" size=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 strlen(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 fa= ce=3D"monospace" 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></div><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" size=3D"4"><br></font></div><div><font face=3D"monospace" si= ze=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> </blockquote></div> --0000000000002f72e805f50b0bf4-- --===============7085502857674999419== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============7085502857674999419== 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 --===============7085502857674999419==--