Splits an author string into its component parts
@param string author The raw author string to split
@return array An array composed of lastname, initial/name
6845
function splitAuthor(author) {
	return author
		.split(/\s*[,\.\s]\s*/)
		.filter(function(i) { return !!i }) // Strip out blanks
		.filter(function(i) { return !/^[0-9]+(st|nd|rd|th)$/.test(i) }); // Strip out decendent numerics (e.g. '1st', '23rd')
}
390988
def _parse_authors(details):
    
    authors = details.find(
        "tr",
        {"id": "ctl00_ContentPlaceHolder1_tblRowAutor"}
    )

    if not authors:
        return []  # book with unspecified authors

    # parse authors from HTML and convert them to Author objects
    author_list = []
    for author in authors[0].find("a"):
        author_obj = Author(author.getContent())

        if "href" in author.params:
            author_obj.URL = author.params["href"]

        author_list.append(author_obj)

    return author_list
614180
private function setAuthorData()
    {
        $this->Author = trim($this->Author);
        $nameParts = explode(' ', $this->Author);
        foreach ($nameParts as $key => $namePart) {
            if ($namePart === '') {
                unset($nameParts[$key]);
            }
        }
        $this->Author = implode(' ', $nameParts);
        /** @var AuthorHelper $author */
        $author = AuthorHelper::get()->filter('OriginalName', trim($this->Author));
        if (!$author->Count()) {
            $author = AuthorHelper::create();
            $author->OriginalName = trim($this->Author);
            $author->write();
        } else {
            $author = $author->first();
        }
        $this->AuthorHelperID = $author->ID;
    }
884473
def __create_author_investigator_str(self):
        
        _author = ""
        try:
            for pub in self.noaa_data_sorted["Publication"]:
                if "author" in pub:
                    if pub["author"]:
                        _author_src = pub["author"]
                        if isinstance(_author_src, str):
                            try:
                                if " and " in _author_src:
                                    _author = _author_src.replace(" and ", "; ")
                                elif ";" in _author_src:
                                    # If there is a semi-colon, add a space after it, just in case it didn't have one
                                    _author = _author_src.replace(";", "; ")
                                break
                            except Exception as e:
                                _author = ""
                        elif isinstance(_author_src, list):
                            try:
                                for _entry in _author_src:
                                    _author += _entry["name"].split(",")[0] + ", "
                            except Exception as e:
                                _author = ""
        except Exception:
            _author = ""
        return _author
1171489
def _parse_authors(element):
    

    authors = []
    items = element.findall("./{%s}author" % WP_NAMESPACE)

    for item in items:
        login = item.find("./{%s}author_login" % WP_NAMESPACE).text
        email = item.find("./{%s}author_email" % WP_NAMESPACE).text
        first_name = item.find("./{%s}author_first_name" % WP_NAMESPACE).text
        last_name = item.find("./{%s}author_last_name" % WP_NAMESPACE).text
        display_name = item.find(
            "./{%s}author_display_name" % WP_NAMESPACE).text

        authors.append({
            "login": login,
            "email": email,
            "display_name": display_name,
            "first_name": first_name,
            "last_name": last_name
        })

    return authors
1321976
def _splituser(host):
    """"""
    user, delim, host = host.rpartition('@')
    return (user if delim else None), host
657700
def __reorganize_authors(authors):
        
        # String SHOULD be semi-colon separated names.
        l = []
        s = authors.split(";")
        for author in s:
            try:
                l.append({"name": author.strip()})
            except AttributeError:
                logger_noaa_lpd.warning("reorganize_authors: AttributeError: authors incorrectly formatted")
        return l
1066066
protected function split($fullName)
    {
        $names = explode(" ", trim($fullName), 2);

        $this->firstName = trim($names[0]);
        $this->lastName = trim($names[1]);
    }
2750
public function byAuthor(string $author): self
    {
        if (!strstr($author, '@')) {
            $this->author = 'nospam@example.com (' . $author . ')';
        } else {
            $this->author = $author;
        }

        return $this;
    }
999399
public static String[] split(String str, char separator) {
    final int len;
    if (str == null 
        || ((len = str.length()) == 0)) {
      return null;
    }

    List<String> componentList = new ArrayList<String>();
    int startIndex = 0;

    for (int i = 0; i < len; i++) {
      if (str.charAt(i) == separator) {
        componentList.add(str.substring(startIndex, i));
        startIndex = i + 1;
      }
    }

    if (str.charAt(len - 1) != separator) {
      componentList.add(str.substring(startIndex, len));
    }

    return componentList.toArray(new String[componentList.size()]);
  }
752850
public static function split(string $string, string $delimiter = ','): array
    {
        return preg_split('/\s*' . preg_quote($delimiter, '/') . '\s*/', $string, -1, PREG_SPLIT_NO_EMPTY);
    }
193759
public static function splitName($class)
    {
        $pos = strrpos($class, '\\');
        if ($pos === false) {
            return [null, $class];
        } else {
            return [substr($class, 0, $pos), substr($class, $pos+1)];
        }
    }
1222067
protected function splitText($part)
    {
        if ($part === 'before' || $part === 'rest')
        {
            $parts = explode(static::separator, $this->text);

            if (count($parts) === 1 && $part === 'rest')
            {
                return null;
            }

            return ($part === 'before') ? current($parts) : end($parts);
        }

        return str_replace(static::separator, '', $this->text);
    }
1347627
public function getContentReplies(string $author, string $permalink)
    {
        $request = [
            'route' => 'get_content_replies',
            'query' =>
                [
                    'author'   => $author,
                    'permlink' => $permalink,
                ]
        ];

        return parent::call($request);
    }
899382
public function setAuthor(Author $author)
    {
        $this->attachment['author_name'] = $author;

        if ($author->hasIcon()) {
            $this->attachment['author_icon'] = $author->getIcon();
        }

        if ($author->hasLink()) {
            $this->attachment['author_link'] = $author->getLink();
        }

        return $this;
    }
739742
private function splitString($string)
    {
        $result = array();
        for ($i = 0; $i < mb_strlen($string, "UTF-8"); ++$i) {
            $result[] = mb_substr($string, $i, 1, "UTF-8");
        }
        return $result;
    }
1079648
def format_author_line(author_names):
    """"""
    author_line = None
    if not author_names:
        return author_line
    if len(author_names) <= 2:
        author_line = ", ".join(author_names)
    elif len(author_names) > 2:
        author_line = author_names[0] + " et al."
    return author_line