Differenze tra le versioni di "Len"

Da Gambas-it.org - Wikipedia.
Riga 2: Riga 2:
  
  
lunghInt = Len(stringa)
+
lunghInt = Len(stringa) As Integer
  
  

Versione delle 16:15, 16 apr 2012

La funzione Len restituisce un integer che rappresenta la lunghezza di una stringa; ossia la quantità di caratteri (compresi gli spazi bianchi ovviamente) che compongono una stringa.


lunghInt = Len(stringa) As Integer


Esempio:

Public Sub Button1_Click()

Dim lunghezza As Integer

  lunghezza = Len("Gambas")

  Print lunghezza

End


In console si avrà il seguente risultato:
6

In Gambas, pertanto, la funzione Len comincia il conteggio da 1 e non da zero.