Capital letter & a dot |
Author: |
Message: |
Bmw1000c
Junior Member
yay!
Posts: 45
44 / / –
Joined: May 2004
|
O.P. RE: Capital letter & a dot
---------------------------
Messenger Plus! Live
---------------------------
Couldn't start script "CapitalLetter".
The script may be defective or you may not have the proper privileges to run scripts.
---------------------------
OK
---------------------------
|
|
06-27-2006 04:27 PM |
|
|
upsfeup
Junior Member
Posts: 67
Joined: Feb 2005
|
RE: Capital letter & a dot
apenas tenho isto e funciona:
code: function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1) + '.'
return sMessage;
}
|
|
06-27-2006 04:31 PM |
|
|
Bmw1000c
Junior Member
yay!
Posts: 45
44 / / –
Joined: May 2004
|
O.P. RE: Capital letter & a dot
lol obrigado, nao vejo diferença nenhuma mas deu na mesma
ENG: tks, i don't see any diference but it works
tks every1
|
|
06-27-2006 04:34 PM |
|
|
steve_xrcc
New Member
Posts: 2
Joined: Jun 2006
|
RE: Capital letter & a dot
I tried the script and I believe some changes could me made to it.
First of all, it should not add a dot after a punctuation symbol (? ! etc..) or any symbol in general (^_^. - it adds a dot) or after emoticons.
Then it should be able to capitalise after a punctuation mark. (Hello! how are you?) The h of how should be capitalised.
I hope I haven't frustrated anyone
This post was edited on 06-30-2006 at 10:24 AM by steve_xrcc.
|
|
06-30-2006 10:24 AM |
|
|
upsfeup
Junior Member
Posts: 67
Joined: Feb 2005
|
RE: Capital letter & a dot
quote: Originally posted by steve_xrcc
I tried the script and I believe some changes could me made to it.
First of all, it should not add a dot after a punctuation symbol (? ! etc..) or any symbol in general (^_^. - it adds a dot) or after emoticons.
Then it should be able to capitalise after a punctuation mark. (Hello! how are you?) The h of how should be capitalised.
I hope I haven't frustrated anyone
That was something that I knew it would'nt work! For that a more complexe code would be necessary. But still possible....
Someone willing to make a cycle that runs each letter and tests for pontuantions?
|
|
06-30-2006 12:19 PM |
|
|
segosa
Community's Choice
Posts: 1407 Reputation: 92
Joined: Feb 2003
|
RE: Capital letter & a dot
I had a go at it, but my mind isn't working very well today so the following is most likely highly inefficient.
code: function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
return punctuate(sMessage);
}
function punctuate(s)
{
var sentences = s.split(" ");
for (var i = 0; i < sentences.length; i++)
{
if (i == sentences.length - 1 && isin(sentences[i].charAt(sentences[i].length - 1), "abcdefghijklmnopqrstuvwxyz0123456789"))
sentences[i] = sentences[i] + ".";
if (i == 0)
sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
else
if (isin(sentences[i-1].charAt(sentences[i-1].length - 1), ".?!"))
sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
}
return sentences.join(" ");
}
function isin(needle, haystack)
{
for (var i = 0; i < haystack.length; i++)
if (haystack.charAt( i ) == needle)
return true;
return false;
}
If it's easier to read/copy/paste I pastebinned it:
http://pastebin.ca/75734
This post was edited on 06-30-2006 at 02:35 PM by segosa.
The previous sentence is false. The following sentence is true.
|
|
06-30-2006 02:34 PM |
|
|
Bmw1000c
Junior Member
yay!
Posts: 45
44 / / –
Joined: May 2004
|
O.P. RE: Capital letter & a dot
tks for the code
This post was edited on 06-30-2006 at 04:08 PM by Bmw1000c.
|
|
06-30-2006 04:06 PM |
|
|
Sypher
Senior Member
Posts: 623 Reputation: 15
37 / /
Joined: Apr 2003
|
RE: Capital letter & a dot
Nice code Segosa!
|
|
06-30-2006 04:20 PM |
|
|
Bmw1000c
Junior Member
yay!
Posts: 45
44 / / –
Joined: May 2004
|
|
06-30-2006 04:22 PM |
|
|
Jellings
Full Member
Posts: 121
34 / / –
Joined: Dec 2004
|
RE: Capital letter & a dot
would it be possible to make it capitalise the first word when a new line is started?
|
|
06-30-2006 10:03 PM |
|
|
Pages: (5):
« First
«
1
[ 2 ]
3
4
5
»
Last »
|
|