你能告诉我我需要在这个脚本中改变什么才能得到这个输出吗?

“输出是 Acailandia”

Function EliminarAcentos(texto)

Dim i, s1, s2
s1 = "ÁÀÉÈÍÏÓÒÚÜáàèéíïóòúüñç"
s2 = "AAEEIIOOUUaaeeiioouunc"
If Len(texto) <> 0 Then
    For i = 1 To Len(s1)
        texto = Replace(texto, Mid(s1,i,1), Mid(s2,i,1))
    Next
End If

EliminarAcentos = texto

End Function

c:> cscript script1 Açailândia

最佳答案

如果你很幸运(脚本和控制台的可比代码页/编码),添加

  • â 到 s1 和 a 到 s2
  • "输出是 "到命令行

  • 会给你:
    cscript 36728122.vbs "The output is Açailândia"
    The output is Acailandia
    

    更新 wrt 评论:

    主要代码:
    WScript.Echo EliminarAcentos(WScript.Arguments(0))
    

    完整代码:
    Option Explicit
    
    Function EliminarAcentos(texto)
        Dim i, s1, s2
        s1 = "ÁÀÉÈÍÏÓÒÚÜáàèéíïóòúüñçâ"
        s2 = "AAEEIIOOUUaaeeiioouunca"
        If Len(texto) <> 0 Then
            For i = 1 To Len(s1)
                texto = Replace(texto, Mid(s1,i,1), Mid(s2,i,1))
            Next
        End If
        EliminarAcentos = texto
    End Function
    
    WScript.Echo EliminarAcentos(WScript.Arguments(0))
    

    关于vbscript - 用变音符号 Á, É, Í, ... 替换字母 A, E, I,,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36728122/

    10-13 02:37