What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » replace_str

replace_str
Author: Message:
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
RE: replace_str
code:
var text = "OK! brb then. Or afk, i maybe take longer time than i think. so please dnd :)";
var array1 = new Array("afk", "brb", "dnd");
var array2 = new Array("<Away From Keyboard>", "<Be Right Back>", "<Do Not Disturb>");

function str_replace(search, replace, subject){
    var f = search, r = replace, s = subject;
    var ra = is_array(r), sa = is_array(s), f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;

    while(j = 0, i--){
        while(s[i] = s[i].split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f);
    }
     
    return sa ? s : s[0];
}

function is_array(m_var){
return (m_var instanceof Array);
}

str_replace(array1, array2, text);


read the JScript 5.6 documentation on arrays
or you can go to W3Schools :)

This post was edited on 05-06-2008 at 11:42 PM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
05-06-2008 09:19 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
replace_str - by Zeelia on 05-06-2008 at 06:36 PM
RE: replace_str - by MeEtc on 05-06-2008 at 08:24 PM
RE: replace_str - by Zeelia on 05-06-2008 at 08:36 PM
RE: replace_str - by roflmao456 on 05-06-2008 at 09:19 PM
RE: replace_str - by Zeelia on 05-06-2008 at 11:01 PM
RE: replace_str - by CookieRevised on 05-07-2008 at 02:09 AM
RE: replace_str - by Zeelia on 05-07-2008 at 11:02 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