Auto capitalize - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: WLM Plus! Help (/forumdisplay.php?fid=12) +----- Thread: Auto capitalize (/showthread.php?tid=98386) Auto capitalize by mplusfan on 09-28-2011 at 01:09 AM
Hi. How can I capitalize a word in a sentence automatically in a conversation? And how to do that after a "."? RE: Auto capitalize by Spunky on 09-28-2011 at 08:17 AM
js code: Probably not the fastest or best way to do it, but I couldn't find a way to do it with pure regex RE: Auto capitalize by mplusfan on 09-28-2011 at 12:33 PM Thanks. RE: Auto capitalize by matty on 09-28-2011 at 12:48 PM
quote:You will want to add spaces after the ".". The current code will turn "..." into ". . . ". RE: Auto capitalize by Spunky on 09-28-2011 at 03:22 PM
quote: Good catch RE: Auto capitalize by CookieRevised on 09-28-2011 at 06:00 PM
had a few minutes to spare and it was a long long time since I used regular expressions (and even Plus! scripting for that matter), so... js code:This also capitalizes the first word of a string. Multiple spaces are taken in account. It also capitalizes after an exclamation mark. It even capitalizes when a new line character is encountered. Example string: " hello world. this is another sentence! this too. and this. HTML stays capitalized...this not\nthis will be capitalized too." Output result: " Hello world. This is another sentence! This too. And this. HTML stays capitalized...this not This will be capitalized too." Important note: I would never use something like that with the OnEvent_ChatWndSendMessage() event as-is though. Code like that can 'corrupt' URLs and other stuff (like literal raw commands) which should not be threated as a pure text. So be very carefull with something like this! It is a nice programming exercise to make something like this, but in practice I highly recommend to never ever use it. So, mplusfan, you could use code like above. But in practice it will always corrupt certain stuff which you do not want! It is much better to simply remember to capitalize sentences manually instead of being 'lazy' (for the lack of a better word). RE: Auto capitalize by Spunky on 09-28-2011 at 06:12 PM Ah, didn't realise it could use anonymous functions for the replace param. Was looking for a way to do it (and my original regex did include multiple space), but all I could find was that it can only be done in POSIX style regex, not perl |