What's this do?


#1

public static boolean unlikely(char c) { if (c < 'a' || c > 'z') return true; return c == 'v' || c == 'x' || c == 'j' || c == 'q' || c == 'z'; }

AFAIK JQVXZ are the 5 least-likely consonants in the English language, and always followed by a vowel. What is the significance, though?
Look at the chat censor in your clients.


#2

Makes sure the letter is between A and Z (obvious), however I’m not sure what the rest is achieving.


#3

[quote=“veer, post:1, topic:446042”][quote author=Coelho link=topic=548877.msg4023602#msg4023602 date=1340187094]
Makes sure the letter is between A and Z (obvious), however I’m not sure what the rest is achieving.
[/quote]

You evidently read the code incorrectly.[/quote]
Holy crap I did. /facepalm


#4

Maybe its for wh3n p30p13 2p31t l1k3 th1s


#5

I can’t really think of a reason for calling that method, can you post the context?


#7

It’s a search optimization. The heuristic is that actual words using those consonants are always followed by a vowel so, if you’re performing a match, you can look at the first letter and conclude that you can disregard matching the rest of the word with some confidence that it’s semantically and syntactically coherent. This is especially true when you consider that the consonants in question are the least frequently used in the English alphabet. If they aren’t immediately followed by a vowel then it’s likely some form of spam.