PRACTICA II-8.       uso de funciones de manipulación de cadenas

EQUIPO   No5

 

 

 

OBJETIVO.- Aprender a manipular cadenas.

 

PROCEDIMIENTO.- Para esta práctica el procedimiento es el siguiente:

 

 

  1. Generar un nuevo Proyecto EXE estandar

 

 

Editar código: Form evento: Activate

 

 

Option Explicit

 

Private Sub Form_Activate()

Dim strMensaje As String

Dim intCuentaVocales As Integer

Dim intContador As Integer

Dim strLetra As String * 1

 

strMensaje$ = "Este es un mensaje de prueba"

 

Print LCase(strMensaje$)

Print UCase(strMensaje$)

Print StrConv(strMensaje$, vbProperCase)

 

Print "El primer espacio es la pocicion:" & _

        InStr(strMensaje$, " ")

Print "De atras para adelante:" & InStrRev(strMensaje$, _

        " ")

       

Print "Texto al reves:" & StrReverse(strMensaje$)

 

Print "Longitud del texto:" & Len(strMensaje$)

 

Print "A partir de la posicion 9,4 letras:" & _

            Mid(strMensaje$, 9, 4)

           

intCuentaVocales% = 0

 

For intContador% = 1 To Len(strMensaje$)

    strLetra$ = Mid(strMensaje$, intContador%, 1)

    If InStr("aeiouAEIOU", strLetra$) > 0 Then

        intCuentaVocales% = intCuentaVocales + 1

    End If

Next intContador%

 

Print "Cantidad de vocales: " & intCuentaVocales%

Print "Remplazando espacios:" & _

        Replace(strMensaje$, " ", "_")

 

End Sub

 

 

                            

 

                                                

                                               

 

 

 

CONCLUSIONES: Puede ser muy útil para alguna aplicación el hecho de poder manipular cadenas de caracteres según la necesidad.