[Gambas-user] Maybe a bug with val functiun

Olivier Coquet olinux at ...289...
Mon Nov 10 06:54:32 CET 2003


Le Dimanche 9 Novembre 2003 18:37, Benoit Minisini a écrit :
> Le Samedi 8 Novembre 2003 18:00, Olivier Coquet a écrit :

> > PUBLIC FUNCTION dte_conv(dte AS String, rev AS Boolean) AS String
> > ' Fonction de convertion de date, si rev = true format = bdd
> > ' si rev = false format à la française
> >   DIM m AS String
> >   DIM j AS String
> >   DIM y AS String
> >
> >   m=""
> >   j=""
> >   y=""
> >
> >   IF rev = FALSE THEN
> >
> >     j = Left$(dte,2)
> >     m = Mid$(dte,4,2)
> >     y = Right$(dte,2)
> >
> >       IF (Val(j) > 31) OR (Val(m) > 12)THEN
> >         RETURN ("")
> >       ELSE
> >         RETURN (m & "-" & j & "-" & y)
> >       ENDIF
> >
> >
> >   ELSE
> >
> >     m = Left$(dte,2)
> >     j = Mid$(dte,4,2)
> >     y = Right$(dte,2)
> >
> >
> >       IF (Val(j) > 31) OR (Val(m) > 12)THEN
> >         RETURN ("")
> >       ELSE
> >         RETURN (j & "-" & m & "-" & y)
> >       ENDIF
> >
> >
> >
> >   ENDIF
> > END
> >
> > ........end of code
> >
> > Regards
> > Olivier
>
> Hi, Olivier.
>
> It's a pity that you don't give me more details to reproduce the bug. See
> my answer to Rob later too.

try to call this function with arg="12.10.2003" an just after with arg 
="aa.bb.cc"

surprise !!!!! result will be: "bb.aa.cc"

stop the prog
try to call the function with arg = "aa.bb.cc" result will be an error !!!!!

> Another point: if you want to start a new thread on the mailing-list, DON'T
> reply to a previous post !
>
> Regards,

regards
olivier





More information about the User mailing list