[Gambas-user] type mismatch: wanted integer, got string instead (solved)
MSulchan Darmawan
bleketux at ...626...
Wed Aug 26 04:01:03 CEST 2009
Pada Tue, 25 Aug 2009 04:29:32 -0600
Dimitris Anogiatis <dosida at ...626...> menulis:
> give it a try MSulchan and tell me if it works for you
Thank you Dimitris, after a little try and error, I change the code
into like this :
IF IsNull(Val(sRain)) = FALSE THEN
IF InStr(LCase(sRain), "x") > 0 OR InStr(sRain, "-") > 0 OR InStr(sRain, ".") > 0 THEN
IF InStr(LCase(sRain), "x") > 0 THEN fRain = 0
IF InStr(sRain, "-") > 0 THEN fRain = 0
IF InStr(sRain, ".") > 0 THEN
sRainy = Replace(sRain, ".", ",")
fRain = Val(sRainy)
ENDIF
ELSE
fRain = CFloat(Val(sRain))
ENDIF
ELSE
fRain = -1
ENDIF
Decided to change iRain (integer) to fRain (float).
As Fabien told that Val() use current localization, so I need to change
the decimal separator from dot to comma.
And I think it is fast enough :D
Thanks again.
--
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/20090826/df196506/attachment.sig>
More information about the User
mailing list