What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Getting partial String (argument to command.)

Getting partial String (argument to command.)
Author: Message:
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Getting partial String (argument to command.)
With regular expression:
code:
if(/^\/(.+?\b)(?: (.*))?$/.test(Message)) {
   var Command = RegExp.$1.toLowerCase();
   var Parameters = RegExp.$2;
   switch(Command) {
      case "run":
         myFunction(Parameters);
         break;
   }
}
I'm not sure if the regular expression is 100% correct, but it works as it's supposed to anyway. With this one, you can have spaces in your parameters and you don't need to count the length of the command. The parameter is also optional (if your command doesn't require parameters, it still works). If you need more than one parameter (separated by a space), you can use another regular expression.
12-01-2006 05:56 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Getting partial String (argument to command.) - by AITEE on 12-01-2006 at 02:46 AM
RE: Getting partial String (argument to command.) - by Spunky on 12-01-2006 at 02:54 AM
RE: Getting partial String (argument to command.) - by phalanxii on 12-01-2006 at 05:56 AM
RE: Getting partial String (argument to command.) - by markee on 12-01-2006 at 06:14 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