What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Release] Exit WLM

[Release] Exit WLM
Author: Message:
Jesus
Scripting Contest Winner
****

Avatar
Koffie, my cat ;)

Posts: 623
Reputation: 15
38 / Male / Flag
Joined: Jul 2005
RE: RE: [Release] Exit Messenger - script attached
quote:
Originally posted by CookieRevised
It also doesn't take in account other spacing characters than ascii 32 (spacebar), which can occur on the command line. To overcome all this use regular expressions.

If you aren't up to using regular expressions you can still use a combination of substr() and IndexOf().

Or easier, use the split() method but with the optional limit parameter:
stringObj.split(" ", 2). This will limit your array to 2 elements, and the second element will always be the parameter.

But also note that with any method you use (except for the regular expression method) you need to take in account additional leading and trailing spaces. Thus you also need to trim the parameter element before using it.

(and take in account the casing of letters too)

Cookie, I don't mean to criticise you, but the stringObj.split(" ", 2) method won't work any better than just using stringObj.split(" ").
The only difference is that with the optional limit parameter, your array is limited to 2 elements, without using the rest of the string.
eg:
code:
var str = "The quick brown fox jumps over the lazy dog.";
return str.split(" ",2);
will return a 2-element array: "The,quick"
so a command like "/command  parameter" (2 spaces in between) will become "/command," with an empty 2nd element.
I had to try this to see it, as it's not in the docs (the limit parameter is, but the fact that it leaves the rest of the string isn't) so even with reading the docs you don't always get where you want ;)

My conclusion is that regular expressions are the best way to go (unfortunately I don't know how to use them yet), but that using stringObj.toLowerCase().split(" ") is an acceptable second, which also takes casing of letters into account.
You could even use a loop to filter out the empty elements caused by extra spaces.

I totally agree with the rest of your post, as usual ;)
12-18-2006 01:37 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Release] Exit WLM - by Spunky on 11-13-2006 at 03:07 AM
RE: [Release] Exit WLM - by NanaFreak on 11-13-2006 at 03:12 AM
RE: [Release] Exit WLM - by MicroWay on 11-13-2006 at 03:16 AM
RE: [Release] Exit WLM - by markee on 11-13-2006 at 03:19 AM
RE: [Release] Exit WLM - by Spunky on 11-13-2006 at 03:21 AM
RE: [Release] Exit WLM - by matty on 11-13-2006 at 03:51 AM
RE: [Release] Exit WLM - by markee on 11-13-2006 at 03:58 AM
RE: [Release] Exit WLM - by CookieRevised on 11-13-2006 at 04:06 AM
RE: [Release] Exit WLM - by matty on 11-13-2006 at 05:22 AM
RE: [Release] Exit WLM - by Spunky on 11-13-2006 at 07:48 PM
RE: [Release] Exit WLM - by Matti on 11-13-2006 at 08:16 PM
RE: [Release] Exit WLM - by Spunky on 11-13-2006 at 08:23 PM
RE: [Release] Exit Messenger - script attached - by CookieRevised on 11-15-2006 at 12:14 AM
RE: RE: [Release] Exit Messenger - script attached - by Jesus on 12-18-2006 at 01:37 PM
RE: RE: RE: [Release] Exit Messenger - script attached - by markee on 12-18-2006 at 02:06 PM
RE: RE: RE: [Release] Exit Messenger - script attached - by CookieRevised on 12-19-2006 at 12:27 AM
RE: RE: RE: RE: [Release] Exit Messenger - script attached - by markee on 12-19-2006 at 02:02 AM
RE: [Release] Exit WLM - by Spunky on 11-15-2006 at 12:29 AM
RE: [Release] Exit WLM - by CookieRevised on 11-15-2006 at 01:17 AM
RE: [Release] Exit WLM - by Aristide on 12-17-2006 at 01:56 PM
Re; [Release] Exit WLM - by BraydenP on 12-18-2006 at 12:37 PM
RE: [Release] Exit WLM - by CookieRevised on 12-19-2006 at 02:06 AM
RE: [Release] Exit WLM - by Spunky on 12-19-2006 at 02:08 AM
RE: [Release] Exit WLM - by warmth on 12-22-2006 at 11:38 PM
RE: [Release] Exit WLM - by Spunky on 12-23-2006 at 01:27 AM
RE: [Release] Exit WLM - by warmth on 12-23-2006 at 08:33 AM


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