[Gambas-user] Val function changed behaviour, porting gambas2 to gambas3

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Nov 2 16:49:11 CET 2016


The new behaviour of val() drove me nuts when it appeared first ;) I had 
used it in so many places, and all over my code. Sometimes it lasts for 
weeks until your program hits this place, and AGAIN val() Arrgh... :)

So in most cases, I ended up either checking for null before (somewhat 
roundabout) or just using CInt() instead.

Regards
Rolf

Am 02.11.2016 16:18, schrieb Richard Welch:
> This is just noting the change in case it might help someone else - not
> a plea for a change.
>
> In g2, the Val function would ignore that part of its input string after
> the first space, so that, for instance Val("12  3 5") would return the
> integer value 12.
>
> Here and there, I use this feature when parsing a string into discrete
> numbers.
>
> Converting to g3 (specifically g3.8.2) this no longer works as before;
> Val now returns Null on such a string.
>
> The solution is obvious: append a space to the string (to guarantee
> there is one!) and then extract up to the first space before using Val.
>
>
>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>





More information about the User mailing list