What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » startsWith() and endsWith()

startsWith() and endsWith()
Author: Message:
jerone
Junior Member
**

Avatar
i like it

Posts: 30
38 / Male / –
Joined: Jun 2006
RE: startsWith() and endsWith()
I don't know if this works in Jscript:
JScript code:
function startsWithToken(orig, str)
{
    return new RegExp("^"+str.replace(/[\|\(\)\$\^\*\+\[\]\?]/,"\$1"),"gi").test(orig);
}
function endsWithToken(orig, str)
{
    return new RegExp(str.replace(/[\|\(\)\$\^\*\+\[\]\?]/,"\$1")+"$","gi").test(orig);
}
console.log(startsWithToken("a$$","a"));  // returns true;
console.log(startsWithToken("$$a","a"));  // returns false;
console.log(endsWithToken("$$a","a"));  // returns true;
console.log(endsWithToken("a$$","a"));  // returns false;

This post was edited on 10-08-2009 at 11:42 AM by jerone.
[Image: Jerone.png]
10-08-2009 11:40 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
startsWith() and endsWith() - by Flippy on 06-17-2009 at 04:59 PM
RE: startsWith() and endsWith() - by Mnjul on 06-17-2009 at 05:28 PM
RE: RE: startsWith() and endsWith() - by Flippy on 06-17-2009 at 06:26 PM
RE: startsWith() and endsWith() - by CookieRevised on 06-17-2009 at 07:19 PM
RE: startsWith() and endsWith() - by Flippy on 06-17-2009 at 07:46 PM
RE: startsWith() and endsWith() - by CookieRevised on 06-17-2009 at 07:52 PM
RE: startsWith() and endsWith() - by markee on 06-18-2009 at 07:46 AM
RE: startsWith() and endsWith() - by CookieRevised on 09-22-2009 at 08:15 AM
RE: startsWith() and endsWith() - by brooooof on 09-27-2009 at 06:43 AM
RE: startsWith() and endsWith() - by jerone on 10-08-2009 at 11:40 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