You are here

private function HumanNameParser_Name::norm in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/Name.php \HumanNameParser_Name::norm()

Removes extra whitespace and punctuation from $this->str Strips whitespace chars from ends, strips redundant whitespace, converts whitespace chars to " ".

Return value

Bool True on success

3 calls to HumanNameParser_Name::norm()
HumanNameParser_Name::chopWithRegex in includes/Name.php
Uses a regex to chop off and return part of the namestring There are two parts: first, it returns the matched substring, and then it removes that substring from $this->str and normalizes.
HumanNameParser_Name::flip in includes/Name.php
Flips the front and back parts of a name with one another. Front and back are determined by a specified character somewhere in the middle of the string.
HumanNameParser_Name::setStr in includes/Name.php
Checks encoding, normalizes whitespace/punctuation, and sets the name string.

File

includes/Name.php, line 103

Class

HumanNameParser_Name
Does cutting and matching stuff with a name string. Note that the string has to be UTF8-encoded.

Code

private function norm() {
  $this->str = preg_replace("#^\\s*#u", "", $this->str);
  $this->str = preg_replace("#\\s*\$#u", "", $this->str);
  $this->str = preg_replace("#\\s+#u", " ", $this->str);
  $this->str = preg_replace("#,\$#u", " ", $this->str);
  return TRUE;
}