Coding Test: Web browser presents an "accept-language" header string with space-separated language plus locale codes. Server has a list of supported language + locale codes. Find all the matches in order of browser's priority. Next step: What if the string is formatted unexpectedly (mixed-case or extra spaces)? What if the browser presents just the language and not the locale -- match against all possible server languages.
Utilisateur anonyme
With an embedded loop, though in retrospect a case-insensitive regexp match would have been cleaner.