[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help on gambas function


Le jeu. 19 déc. 2024 à 11:41, Bruce Steers <bsteers4@xxxxxxxxx> a écrit :

> You're welcome :)
> Yes I guess it follows gambas logic with commands like FromString,
> FromHtml, etc
>

Well it's true but the other treatment for bases are not in the same way
(bin/hex/oct) so it have confused me .. and even the fact that there is a
link to formatting functions that do not rely to Dec or FromBase... (Maybe
because they are in converting.. well)

I will think to add a link to Dec also in Bin/Hex/oct to let know to the
user the existance of this useful function 😊.


> But i agree Base should also mention FromBase in the wiki.
> i've just added a Base link to FromBase and a FromBase link to Base wiki
> pages
> Respects
> BruceS
>
>
Thank you

>
> On Thu, 19 Dec 2024 at 08:19, Fabien Bodard <gambas.fr@xxxxxxxxx> wrote:
>
>> Yes 😊... We must put the opposite in the Base doc.
>>
>> FromBase is a logical name ... And it seem not so much for me 😅.
>>
>> Thank you a lot
>>
>> Le mer. 18 déc. 2024 à 18:13, Bruce Steers <bsteers4@xxxxxxxxx> a écrit :
>>
>>>
>>> FromBase / Dec ?
>>> https://gambaswiki.org/wiki/lang/frombase
>>> https://gambaswiki.org/wiki/lang/dec2
>>>
>>>
>>> BruceS
>>>
>>> On Wed, 18 Dec 2024 at 11:13, Fabien Bodard <gambas.fr@xxxxxxxxx> wrote:
>>>
>>>>
>>>>
>>>> ---------- Forwarded message ---------
>>>> De : Fabien Bodard <gambas.fr@xxxxxxxxx>
>>>> Date: mar. 17 déc. 2024 à 11:23
>>>> Subject: Need help on gambas function
>>>> To: Fabien Bodard (Greumbeule) <gambas.fr@xxxxxxxxx>
>>>>
>>>>
>>>> Hi to all
>>>>
>>>> In gambas you can :
>>>>
>>>> s = Hex(iInt)
>>>>
>>>> And
>>>> print  Cint("&H" & S)
>>>>
>>>> Give you back the int
>>>> Well now I Want :
>>>> Base(iInt, 36)
>>>>
>>>> How can I get My integer back ... in gambas "native" ?
>>>> Is there an UnBase function ?
>>>>
>>>> Thank you :-)
>>>>
>>>>
>>>> Public Sub Base36Decoder(Value As String) As Long
>>>>
>>>>   Dim lResult As Long
>>>>   Dim iDigitVal, i As Integer
>>>>   Dim aNum As Byte[] = Byte[].FromString(UCase(Value)).Reverse()
>>>>
>>>>   For i = 0 To aNum.Max
>>>>     iDigitVal = IIf(aNum[i] >= Asc("0") And aNum[i] <= Asc("9"),
>>>> aNum[i] - 48, aNum[i] - 55)
>>>>     lResult += iDigitVal * (36 ^ i)
>>>>   Next
>>>>
>>>>   Return lResult
>>>>
>>>> End
>>>>
>>>>
>>>> --
>>>> Fabien Bodard
>>>>
>>>>
>>>> --
>>>> Fabien Bodard
>>>>
>>>

References:
Fwd: Need help on gambas functionFabien Bodard <gambas.fr@xxxxxxxxx>
Re: Need help on gambas functionBruce Steers <bsteers4@xxxxxxxxx>
Re: Need help on gambas functionFabien Bodard <gambas.fr@xxxxxxxxx>
Re: Need help on gambas functionBruce Steers <bsteers4@xxxxxxxxx>