Thread: swear filter
View Single Post
  #2  
Old 04-24-2008, 09:17 PM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by [email protected] View Post
talking to someone about it earlier, was fun to try out he he

PHP Code:
function onCreated() {
  
temp.chat = "Hello you ****ing queer ****!";
  
temp.illegal = {"****ing", "queer", "****"};

  
temp.token = chat.tokenize();
  
temp.len = null;
  
temp.res = "";
  
  for (
temp.i: token) {
    if (
i in illegal) {
      for (
len = 0; len < i.length(); len++) 
        
res @= randomstring("$", "£", "#");
    } else 
    for (
temp.c: illegal) {
      if (
i.starts(c)) {
        for (
len = i.charat(c); len < c.length(); len++) 
          
res @= randomstring("$", "£", "#");
        
res @= i.substring(c.length());
      }
    }
    if (
len == null)
      
res @= i;
    
    
temp.output @= res.trim() @ " ";
    
res = "";
    
len = null;
  }
  
  echo(
output);
} 
Looks good, but I highly suggest you not use the Euro sign ... its not supported on some machines.
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote