FUNCTION caracterespecial
PARAMETER xcadena
xaliasanterr33 = ALIAS()
IF .NOT. USED('caracteres')
DO xcaracteresv1
ENDIF
SELECT caracteres
SCAN FOR ok = 0 .OR. .NOT. EMPTY(lh)
IF LIKE("*" + ld + "*", xcadena)
xcadena = (reemplazacadena(xcadena, ld, ALLTRIM(lh)))
ENDIF
ENDSCAN
SELECT (xaliasanterr33)
RETURN (xcadena)
ENDFUNC
PROCEDURE xcaracteresv1
CREATE CURSOR caracteres (ld C (1), nd N (3), lh C (1), nh N (3), ok N (1), r N (1))
FOR c = 1 TO 255
APPEND BLANK
REPLACE ld WITH CHR(c)
REPLACE nd WITH c
ENDFOR
REPLACE lh WITH 'a' ALL FOR ld = '@'
REPLACE lh WITH 'y' ALL FOR ld = '&'
REPLACE lh WITH 'a' ALL FOR ld = 'á'
REPLACE lh WITH 'e' ALL FOR ld = 'é'
REPLACE lh WITH 'i' ALL FOR ld = 'í'
REPLACE lh WITH 'o' ALL FOR ld = 'ó'
REPLACE lh WITH 'u' ALL FOR ld = 'ú'
REPLACE lh WITH 'a' ALL FOR ld = 'à'
REPLACE lh WITH 'e' ALL FOR ld = 'è'
REPLACE lh WITH 'i' ALL FOR ld = 'ë'
REPLACE lh WITH 'o' ALL FOR ld = 'n'
REPLACE lh WITH 'u' ALL FOR ld = 'ù'
REPLACE lh WITH 'a' ALL FOR ld = 'ä'
REPLACE lh WITH 'e' ALL FOR ld = 'ë'
REPLACE lh WITH 'i' ALL FOR ld = 'ï'
REPLACE lh WITH 'o' ALL FOR ld = 'ö'
REPLACE lh WITH 'u' ALL FOR ld = 'ü'
REPLACE lh WITH 'a' ALL FOR ld = 'â'
REPLACE lh WITH 'e' ALL FOR ld = 'ê'
REPLACE lh WITH 'i' ALL FOR ld = 'î'
REPLACE lh WITH 'o' ALL FOR ld = 'ô'
REPLACE lh WITH 'u' ALL FOR ld = 'û'
REPLACE lh WITH 'A' ALL FOR ld = 'Á'
REPLACE lh WITH 'E' ALL FOR ld = 'É'
REPLACE lh WITH 'I' ALL FOR ld = 'Í'
REPLACE lh WITH 'O' ALL FOR ld = 'Ó'
REPLACE lh WITH 'U' ALL FOR ld = 'Ú'
REPLACE lh WITH 'A' ALL FOR ld = 'À'
REPLACE lh WITH 'E' ALL FOR ld = 'È'
REPLACE lh WITH 'I' ALL FOR ld = 'Ì'
REPLACE lh WITH 'O' ALL FOR ld = 'Ò'
REPLACE lh WITH 'U' ALL FOR ld = 'Ù'
REPLACE lh WITH 'A' ALL FOR ld = 'Ä'
REPLACE lh WITH 'E' ALL FOR ld = 'Ë'
REPLACE lh WITH 'I' ALL FOR ld = 'Ï'
REPLACE lh WITH 'O' ALL FOR ld = 'Ö'
REPLACE lh WITH 'U' ALL FOR ld = 'Ü'
REPLACE lh WITH 'A' ALL FOR ld = 'Â'
REPLACE lh WITH 'E' ALL FOR ld = 'Ê'
REPLACE lh WITH 'I' ALL FOR ld = 'Î'
REPLACE lh WITH 'O' ALL FOR ld = 'Ô'
REPLACE lh WITH 'U' ALL FOR ld = 'Û'
REPLACE lh WITH 'n' ALL FOR ld = 'n'
REPLACE lh WITH 'N' ALL FOR ld = 'Ñ'
REPLACE nh WITH ASC(lh) ALL FOR .NOT. EMPTY(lh)
REPLACE r WITH 1 ALL FOR .NOT. EMPTY(nh)
REPLACE ok WITH 1 ALL FOR ld = ' '
REPLACE ok WITH 1 ALL FOR ld = '_'
REPLACE ok WITH 1 ALL FOR nd = 47
REPLACE ok WITH 1 ALL FOR nd >= 39 .AND. nd <= 90
REPLACE ok WITH 1 ALL FOR nd >= 97 .AND. nd <= 122
REPLACE ok WITH 1 ALL FOR .NOT. EMPTY(nh)
REPLACE lh WITH '.' ALL FOR ok = 0 .AND. EMPTY(lh)
RETURN
**
PROCEDURE reemplazacadena
PARAMETER xtcadena, xpalabrai, ;
xpalabraf
IF LEN(xpalabraf) > 1
xpalabrai = UPPER(xpalabrai)
xpalabraf = UPPER(xpalabraf)
xtcadena = UPPER(xtcadena)
ENDIF
xtcadena = (xtcadena)
xpalabrai = (xpalabrai)
xpalabraf = (xpalabraf)
xlpalabrai = LEN(xpalabrai)
xi = 1
textofinal = ''
ss = 0
FOR cssss = 1 TO LEN(xtcadena)
IF SUBSTR((xtcadena), cssss, ;
(xlpalabrai)) = ;
(xpalabrai)
xsubstrae = SUBSTR(xtcadena, ;
cssss, ;
xlpalabrai)
xtcadenalf = LEFT(xtcadena, ;
cssss - ;
1)
textofinal = textofinal + ;
xpalabraf
cssss = cssss + ;
LEN(xpalabrai) - ;
1
ELSE
textofinal = textofinal + ;
SUBSTR(xtcadena, ;
cssss, 1)
ENDIF
ENDFOR
RETURN (textofinal)
ENDPROC