You are here

public function PARSEENTRIES::removeDelimiters in Bibliography Module 7

Same name and namespace in other branches
  1. 5 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::removeDelimiters()
  2. 6.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::removeDelimiters()
  3. 6 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::removeDelimiters()
  4. 7.3 plugins/biblio_style/bibtex/PARSEENTRIES.php \PARSEENTRIES::removeDelimiters()
  5. 7.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::removeDelimiters()

Remove delimiters from a string.

1 call to PARSEENTRIES::removeDelimiters()
PARSEENTRIES::removeDelimitersAndExpand in modules/bibtexParse/PARSEENTRIES.php
Remove enclosures around entry field values. Additionally, expand macros if flag set.

File

modules/bibtexParse/PARSEENTRIES.php, line 388

Class

PARSEENTRIES
// Parse a file $parse = NEW PARSEENTRIES(); $parse->expandMacro = TRUE; // $array = array("RMP" =>"Rev., Mod. Phys."); // $parse->loadStringMacro($array); // $parse->removeDelimit = FALSE; // …

Code

public function removeDelimiters($string) {
  if ($string && $string[0] == "\"") {
    $string = substr($string, 1);
    $string = substr($string, 0, -1);
  }
  elseif ($string && $string[0] == "{") {
    if (strlen($string) > 0 && $string[strlen($string) - 1] == "}") {
      $string = substr($string, 1);
      $string = substr($string, 0, -1);
    }
  }
  elseif (!is_numeric($string) && !array_key_exists($string, $this->strings) && array_search($string, $this->undefinedStrings) === FALSE) {

    // Undefined string that is not a year etc.
    $this->undefinedStrings[] = $string;
    return '';
  }
  return $string;
}