Author | Message | Time |
---|---|---|
Spht | This will censor a word producing the same results as battle.net's censorship [code]Public Function censorword(ByVal text As String) As String Dim m As String Dim ml As Integer Dim i As Integer Dim c As Integer Dim x As Integer Dim n As Integer Dim p As Integer Dim l As Integer Dim s As String m = "a@b#c$d%e&f!g!h!i@j#k$l%m&n!o!p!q@r#s$t%u&v!w!x!y@z#" ml = CInt(Len(m)) For i = 1 To Len(text) c = Asc(Mid(text, i, 1)) n = ((c - Asc("a")) * 2) + 1 If n > 0 And n < ml Then '// if it's a letter from a to z p = 1 Do Until x <> l If (n + p) > ml Then n = 1 p = 1 End If x = Asc(Mid(m, n + p, 1)) p = p + 2 Loop s = s & Chr(x) l = x Else s = text Exit For End If Next i censorword = s End Function[/code] Battle.net's censor works fairly simply. there's a letter map which describes which symbol covers each word. if the current symbol is the same as last, it uses the next unique symbol in the map Note this is just what i reversed based on the pattern that the known 28 censored words follow. also, in running battle.net the results are very likely hardcoded Ex: censorword("skywing") = "$%@!@!@" | May 30, 2008, 9:17 PM |
Barabajagal | Could'a just added that to this topic... | May 30, 2008, 10:02 PM |