You can't make it much quicker than this I think (in VBS at least)... In JS it can be made a bit more effecient as you can change parts of a string; in VBS you can only add to a string.
code:
Function Talker(Input)
Dim i, j
Dim Output
i = 0
Output = ""
Do
j = i + 1
i = InStr(j, " " & Input, " ")
If i <> 0 Then Output = Output & LCase(Mid(Input, j, i - j)) & UCase(Mid(Input, i, 1))
Loop Until i = 0
Talker = Output & LCase(Mid(Input, j))
End Function
Note: this does NOT take in acount _real_ words. This means textual words which are delimited by commas are other textual delimiters are not reconized. The only reconition done is by space:
"this sEntEnce will be cHanged.but this and ,that not;this neither."
=>
"This Sentence Will Be Changed.
but This And ,
that Not;
this Neither."
-----------
To also have that you need to add the following (again VBS):
code:
Function Talker(Input)
Dim i, j
Dim Output
i = 0
j = 1
Output = ""
Do
j = i + 1
i = InstrFirst(j, " " & Input, " ,;.?!()")
If i <> 0 Then Output = Output & LCase(Mid(Input, j, i - j)) & UCase(Mid(Input, i, 1))
Loop Until i = 0
Talker = Output + LCase(Mid(Input, j))
End Function
Function InstrFirst(Start, String, Delimiters)
Dim iFirst, iDel, iSearch
iFirst = Len(String) + 1
For iDel = 1 To Len(Delimiters)
iSearch = InStr(Start, String, Mid(Delimiters, iDel, 1))
If (iSearch < iFirst) And (iSearch <> 0) Then iFirst = iSearch
Next
If iFirst = Len(String) + 1 Then
InstrFirst = 0
Else
InstrFirst = iFirst
End If
End Function
"this sEntEnce will be cHanged.also this and ,that;this also."
=>
"This Sentence Will Be Changed.Also This And ,That;This Also."
All this can be made a bit more efficient in JScript...
Also, if you use Regular Expressions it can be made even more efficient (both in JScript as in VBS)