[Gambas-user] gb.gui.webview
Benoît Minisini
g4mba5 at gmail.com
Sun Apr 25 23:35:53 CEST 2021
Le 25/04/2021 à 22:54, Tobias Boege a écrit :
> 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
>
If you want to convert versions, you must use:
Comp(Version1, Version2, gb.Natural)
Regards,
--
Benoît Minisini
More information about the User
mailing list