Gambas-it

Gambas dal mondo esterno => Mailing List => Topic aperto da: vuott - 01 Agosto 2015, 17:15:30

Titolo: mkinteger()... e la sua funzione inversa
Inserito da: vuott - 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
"