Autore Topic: mkinteger()... e la sua funzione inversa  (Letto 145 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.394
  • Ne mors quidem nos iunget
    • Mostra profilo
mkinteger()... e la sua funzione inversa
« il: 01 Agosto 2015, 17:15:30 »
Riporto questa discussione:


" I'm using MkInteger$, MkShort$

Who knows what the opposite functions would be.  I can't find them



Codice: gambas [Seleziona]
myString = MkInteger$(12345678)   'convert an integer to a string representation
myInteger = ?? (myString)         'convert back to an integer


anyone?
-Nando
"


" It's Integer@():

Codice: gambas [Seleziona]
Print Integer@(MkInteger$(12345678))

12345678

Regards,

--
Benoît Minisini
"


" ...or... if you want (to write more code) ....

Codice: gambas [Seleziona]
Public Sub Main()

  Dim s As String
  Dim i As Integer

   s = MkInteger(123456)

   i = Asc(s, 1)
   i += Asc(s, 2) * 256             ' &0100
   i += Asc(s, 3) * 65536         ' &010000
   i += Asc(s, 4) * 16777216   ' &01000000
 
   Print i

End



Regards
vuott
"
« Ultima modifica: 01 Agosto 2015, 17:55:23 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »