0% found this document useful (0 votes)
10 views1 page

String Storage and Management Class

This document defines a class named Class1 that manages a string array with a maximum size of 10. It includes methods for storing a word, searching for a word, retrieving a word by its position, and deleting all stored words. The class maintains a variable to track the number of stored words and provides appropriate return values for each operation.

Uploaded by

bahanen124
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

String Storage and Management Class

This document defines a class named Class1 that manages a string array with a maximum size of 10. It includes methods for storing a word, searching for a word, retrieving a word by its position, and deleting all stored words. The class maintains a variable to track the number of stored words and provides appropriate return values for each operation.

Uploaded by

bahanen124
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Public Class Class1

Private Const maxpos = 10


Private almacen(maxpos - 1) As String
Private poslibre As Double

Public Function guardar(palabra As String) As Integer

If poslibre >= maxpos Then


Return -1
Else
almacen(poslibre) = palabra
poslibre += 1
Return 1
End If
End Function
Public Function buscar1(palabra As String) As Integer

For i = 0 To poslibre - 1
If almacen(i) = palabra Then
Return 1

End If
Next
Return -1

End Function
Public Function buscar2(posicion As Double) As String
Return almacen(posicion)
End Function
Public Function eliminar() As Integer
For i = 0 To poslibre
almacen(i) = ""

Next
poslibre = 0
Return 1
End Function
End Class

You might also like