What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » StuffPlug Talker

StuffPlug Talker
Author: Message:
spokes
Full Member
***

Avatar
I <3 Rollerblading

Posts: 423
Reputation: 10
34 / Male / Flag
Joined: May 2004
O.P. Huh?  StuffPlug Talker
Can anyone make me a quick talker that will make the first letter of every word upper case?

i'm not good with JS or VBS

thanx

[Image: sig15ws.png]
09-27-2005 09:18 PM
Profile E-Mail PM Web Find Quote Report
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
RE: StuffPlug Talker
So You Want Something Like This?
09-27-2005 09:24 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: StuffPlug Talker
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)

This post was edited on 09-27-2005 at 11:00 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-27-2005 10:27 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On