public function HumanNameParser_Name::flip in Bibliography Module 6.2
Same name and namespace in other branches
- 7 includes/Name.php \HumanNameParser_Name::flip()
File
- includes/
Name.php, line 74
Class
- HumanNameParser_Name
- Does cutting and matching stuff with a name string. Note that the string has to be UTF8-encoded.
Code
public function flip($flipAroundChar) {
$substrings = preg_split("/{$flipAroundChar}/u", $this->str);
if (count($substrings) == 2) {
$this->str = $substrings[1] . " " . $substrings[0];
$this
->norm();
}
else {
if (count($substrings) > 2) {
throw new Exception("Can't flip around multiple '{$flipAroundChar}' characters in: '{$this->str}'.");
}
}
return true;
// if there's 1 or 0 $flipAroundChar found
}