1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Remover Acentos

Discussão em 'Progress 4GL' iniciado por fdantas, Março 5, 2009.

  1. fdantas

    fdantas Administrator Moderador

    Essa rotina remoce acentos e caracteres especiais.

    Código:
    FUNCTION RemoveAbove127 RETURNS CHAR
     (c AS CHAR):
        DEFINE VARIABLE iLength AS INTEGER    NO-UNDO.
        DEFINE VARIABLE i       AS INTEGER    NO-UNDO.
    
        /* replace accents by characters without accents */
        ASSIGN
         c = REPLACE(c,'é','e')
         c = REPLACE(c,'è','e')
         /* add same code to handle other accents here*/
         c = REPLACE(c,'à','a').
    
        /* make sure there is no character above 127, replace them by '#'
    (example) */
        iLength = LENGTH(c).
        DO i = 1 TO iLength:
            IF ASC(SUBSTRING(c,i,1)) < 128 THEN NEXT.
            SUBSTRING(c,i,1) = "#".
        END.
        RETURN c.
    END FUNCTION.
    
    

Compartilhe esta Página