'{Funcion quita los acentos de las vocales}
Public Function SinAcento(Cadena As String) As String
Dim tm As Integer
Dim l As Single
Dim z As String
Dim final As String
tm = Len(cadena)
For l = 1 To tm
z = Mid(cadena, l, 1)
Select Case z
Case z = "á"
z = "a"
Case z = "é"
z = "e"
Case z = "í"
z = "i"
Case z = "ó"
z = "o"
Case z = "u"
z = "ú"
End Select
final = final & z
Next
Return Trim(final)
End
Public Sub Main()
Dim cadena As String = "áéíóú"
Dim l As Short
For l = 1 To Len(cadena)
Select Case String.Mid(cadena, l, 1)
Case "á"
cadena = Replace(cadena, "á", "a")
Case "é"
cadena = Replace(cadena, "é", "e")
Case "í"
cadena = Replace(cadena, "í", "i")
Case "ó"
cadena = Replace(cadena, "ó", "o")
Case "ú"
cadena = Replace(cadena, "ú", "u")
End Select
Next
Print cadena
End
Public Sub Form_Open()
Dim sString As String = "Lo miraré en la máquina virtual áéíóúñüÁÉÍÓÚÑÜ aeiounu AEIOUNU"
Print sString
Print SinAcento(sString)
End
Public Sub SinAcento(Cadena As String) As String
Dim iOld As Integer[] = [225, 233, 237, 243, 250, 241, 252, 193, 201, 205, 211, 218, 209, 220]
Dim iNew As Integer[] = [97, 101, 105, 111, 117, 110, 117, 65, 69, 73, 79, 85, 78, 85]
Dim iLoop, iBuild As Integer
Dim sNew As String
For iLoop = 1 To String.Len(Cadena)
iBuild = String.Code(Cadena, iLoop)
If iOld.Find(iBuild) > -1 Then sNew &= String.Chr(iNew[iOld.Find(iBuild)]) Else sNew &= String.Chr(iBuild)
Next
Return sNew
End
(21-12-2021, 01:52)alessandri escribió: Pero si habilito gb.utilit me genera un error -VIOLACION DE SEGMENTO-
esto es en Linux Mint 19.3 32bits con Cinnamon y GB3.16.1, Cpu Core-i5
8Gb de RAM.
Static Public Sub RemoveDiacritics({String} As String) As String
If Not {String} Then Return
If IsAscii({String}) Then Return {String}
Return DoRemoveAccents({String})
End
(22-12-2021, 22:39)guizans escribió: Para que sirven llaves que hay en el parámetro que recibe el método?...es simplemente un nombre de variables.