你能告诉我在这个脚本中我需要改变什么来获得这个输出吗?
“输出是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:GT; cscriptscript1Açailândia
答案 0 :(得分:2)
如果您幸运(脚本和控制台的可比代码页/编码),请添加
会给你:
cscript 36728122.vbs "The output is Açailândia"
The output is Acailandia
更新评论:
主要代码:
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))