document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \' Gambas class file
  2.  
  3. Inherits Iterador
  4. Private conte As String
  5.  
  6. Private posicion As Integer = 0
  7.  
  8. Public Sub _new(contenido As String)
  9.  
  10.   conte = contenido
  11.  
  12. End
  13.  
  14. Public Function currenItem() As Variant
  15.  
  16.   Return Super.getlista()[posicion]
  17.  
  18. End
  19.  
  20. Public Function primero() As Variant
  21.  
  22.   posicion = 0
  23.   While isdone()
  24.     If InStr(Super.getlista()[posicion], conte) <> 0 Then
  25.       \'posicion ya contiene el texto que necesito...
  26.       Break
  27.     Endif
  28.    
  29.     posicion += 1
  30.   Wend
  31.  
  32.   Return currenItem()
  33.  
  34. End
  35.  
  36. Public Function siguiente() As Variant
  37.  
  38.   posicion += 1
  39.   While isdone()
  40.     If InStr(Super.getlista()[posicion], conte) <> 0 Then
  41.       \'posicion ya contiene el texto que necesito...
  42.       Break
  43.     Endif
  44.    
  45.     posicion += 1
  46.   Wend
  47.  
  48.   If isdone() Then
  49.     Return currenItem()
  50.     \' Else
  51.     \' posicion = 0 \'vuelvo a empezar...
  52.     \' Return currenItem()
  53.   Endif    
  54.  
  55. End
  56.  
  57. Public Function isdone() As Boolean
  58.   \'hay siguiente?
  59.  
  60.   If posicion < Super.getlista().count Then        
  61.     \'si, hay siguiente
  62.     Return True
  63.   Else              
  64.     \'no, ya se ha acabado la lista...
  65.     Return False
  66.   Endif
  67.  
  68. End
');