[Gambas-user] gb.gui.webview

Tobias Boege tobs at taboege.de
Sun Apr 25 22:54:38 CEST 2021


On Sun, 25 Apr 2021, T Lee Davidson wrote:
> On 4/25/21 4:02 PM, Martin wrote:
> > An optimal solution, thanks for the help.
> > 
> > Regards.
> > 
> > El 25/4/21 a las 21:03, T Lee Davidson escribió:
> > > On 4/25/21 2:40 PM, Martin wrote:
> > > > But, ¿How to check properly the gambas version?
> > > 
> > > If CInt(Split(System.FullVersion, ".")[1]) < 16  then
> > >   Webview1.HTML = "the_HTML_Code"
> > > else
> > >   Webview1.SetHtml("the_HTML_Code")
> > > endif
> > > 
> > > 
> > 
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 
> I had forgotten that Gambas is quite adept at making comparisons on strings based on natural number sorting. You could also do:
> System.FullVersion < "3.16.0"
> 

This might be good enough but it's not "good" in absolute terms.
The < operator doesn't recognize embedded versions and compare them
correctly. While with recent versions

  "3.10.0" < "3.16.0" = True,

you also have

  "3.2.0" < "3.16.0" = False,  or
  "3.100.0" < "3.16.0" = True.

In fact, when you compare strings, I don't think there is any implicit
conversion or special treatment of numbers happening: try "010" < "1",
which returns True.

So, you didn't forget. It really doesn't work.

Best,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list