VBScript Remove Accents

VBS script to remove accents in a text file in the same directory.

VBScript Remove Accents

delete_duplicate.vbs

 

Const accent = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç"
Const noAccent = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc"

Function sansAccents(ByRef s)
Dim i
Dim lettre
sansAccents = s
For i = 1 To Len(accent)
lettre = Mid(accent, i, 1)
If InStr(sansAccents, lettre) > 0 Then
sansAccents = Replace(sansAccents, lettre, Mid(noAccent, i, 1))
End If
Next
End Function


Dim demo
demo = "L'été, je vais sur l'île où y'a la fête jusqu'à l'aube et" & _
" je hurle: YÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÙÚÛÜùúûü ... "
Wscript.echo demo & vbCrLf & " => " & sansAccents(demo)

Const ForReading = 1
Const ForWriting = 2
lefichier= InputBox("File name :" & VBCRLF & "(Ex: ""toto.txt"")")
If (lefichier <> "") Then
WScript.Sleep 200
else
wscript.Echo "You must enter a file name (in the same directory)"
Wscript.Quit
end if

strKey=""
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(lefichier, ForReading)

Do Until objFile.AtEndOfStream
strName = objFile.ReadLine
'if (len(strName)<6) Then

strKey = strKey & vbCrLf & LCase(sansAccents(strName))

'End If
Loop

objFile.Close

Set objFile = objFSO.OpenTextFile _
(lefichier, ForWriting)

objFile.WriteLine strKey

objFile.Close

FREE

VBScript Remove Accents

remove-accents.vbs


Ludo.One

Quality tools for Webmasters !

A collection of free or paid PHP scripts and Prestashop modules. Download free and paid website scripts and tools. Each of the PHP scripts here includes complete PHP source codes

Contact Details

Phone: +33781217982
Email:
Website: www.Ludo.One