@graup stuff |
A loose collection of interesting stuff I come across. Programming, Traveling, Studying Also check out my personal homepage |
Ich wurde an der TU Berlin für den Studiengang Technische Informatik angenommen. Jetzt muss ich mich nur noch immatrikulieren. Bin schon sehr gespannt auf das Studium – ich war lange unschlüssig, ob das das Richtige sein wird, aber die Mailingsliste der Freitagsrunde hat mich überzeugt.
Wenn alles klappt, werde ich hier ein bisschen über das Studium informieren.
We needed a way to normalize user names. Cuz you know, people keep entering their names in an ugly way, which annoys the admins’ eyes.
As it turns out, there’s actually a function built into PHP which does that. I then added a revert for words like “von” or “of”.
All put together (with credits to the at psychoticneurotic dot com):
function name($string) {
$exceptions = array('von','de','to', 'a', 'der', 'the', 'of', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X');
$string = mb_convert_case($string, MB_CASE_TITLE, "UTF-8");
/* revert exceptions */
$words = explode(' ',$string);
$words2 = array();
foreach($words AS $word) {
if (in_array(strtolower($word), $exceptions)) {
$word = strtolower($word);
}
array_push($words2, $word);
}
$string = implode(' ',$words2);
return $string;
}
JU @ Netzpolitik.org
Tiber =)
New York :-)
Star Wars Ep.IV - Final Scene (Throne Room) & End Credits
The 10 Greatest Sounds from Star Wars
Twitter macht Dumm, Facebook macht schlau