[Gambas-user] type mismatch: wanted integer, got string instead (solved)

MSulchan Darmawan bleketux at ...626...
Mon Aug 31 04:31:39 CEST 2009


Pada Fri, 28 Aug 2009 11:23:59 +0200
Fabien Bodard <gambas.fr at ...626...> menulis:

> IF NOT sRain THEN
>  IF InStr(LCase(sRain), "x") > 0 OR InStr(sRain, "-") > 0 THEN
>    fRain=0
>  ELSE
>    TRY fRain = CFloat(sRain)
>    IF ERROR THEN fRain=-1  'Not a Valid Number
>  ENDIF
> ELSE
>  fRain=-1
> ENDIF

Thanks Fabien,

But First, I need to change dot to comma as decimal separator, since
the original string at the database was dot.

Does "TRY fRain = CFloat(sRain)" automatically turn into floating
number without detecting localization ?

My latest code was working, so I didn't touch it again. But looks like
yours more simpler and efficient :D

-- 
Cheers,
[-Sulchan-]
Terbang dengan claws-mail 3.7.2
Mendarat di hardy heron 8.04.3 LTS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090831/bf932852/attachment.sig>


More information about the User mailing list