Thread: swear filter
View Single Post
  #1  
Old 04-24-2008, 09:12 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
swear filter

talking to someone about it earlier, was fun to try out he he

PHP Code:
function onCreated() {
  
temp.chat = "Hello you ****ing queer ****! I hope that you****ing die!!";
  
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());
      } else if(
i.ends(c)) {
        
res @= i.substring(0, i.length() - c.length());
        for (
len = i.charat(c); len < c.length(); len++) 
          
res @= randomstring("$", "£", "#");
      }
    }
    if (
len == null)
      
res @= i;
    
    
temp.output @= res.trim() @ " ";
    
res = "";
    
len = null;
  }
  
  echo(
output);
} 
Reply With Quote