What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » # of characters in a message?

# of characters in a message?
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: # of characters in a message?
I suggest you have a look at a JavaScript String reference, such as the one at W3Schools. That should give you a good idea what methods you have.
  • To check the first X characters of a string:
    code:
    var strMessage = "/mycommand param1";
    if(strMessage.substr(0, 3) === "/my") {
       //First 3 characters equal "/my"
       //Do something useful here!
    }
    String.substr(X, Y) basically does the following: Give me the part of the string starting at position X containing at most Y characters. You could also use String.substring(X, Y), where Y is an ending position instead of a length. If you don't specify the second argument in substr() or substring(), it'll go on to the end of the string.
  • To strip the first X characters from a string:
    code:
    var strMessage = "one two three";
    var strPiece = strMessage.substr(4);
    //strPiece now contains "two three"
As you already have PHP knowledge, this should actually be piece of cake for you. Basically, String.substr(start, length) is the JScript equivalent for PHP's substr($string, $start, $length). The difference is that JScript does this in a more OOP-style. :)

This post was edited on 11-15-2008 at 05:25 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
11-15-2008 05:25 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
# of characters in a message? - by citricsquid on 11-15-2008 at 04:53 PM
RE: # of characters in a message? - by Matti on 11-15-2008 at 05:25 PM
RE: RE: # of characters in a message? - by citricsquid on 11-15-2008 at 05:30 PM
RE: # of characters in a message? - by Volv on 11-15-2008 at 05:39 PM
RE: RE: # of characters in a message? - by citricsquid on 11-15-2008 at 05:43 PM
RE: # of characters in a message? - by Matti on 11-15-2008 at 08:27 PM


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