You are here

function PARSEENTRIES::explodeString in Bibliography Module 6

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

File

bibtexParse/PARSEENTRIES.php, line 364

Class

PARSEENTRIES

Code

function explodeString($val) {
  $openquote = $bracelevel = $i = $j = 0;
  while ($i < strlen($val)) {
    if ($val[$i] == '"') {
      $openquote = !$openquote;
    }
    elseif ($val[$i] == '{') {
      $bracelevel++;
    }
    elseif ($val[$i] == '}') {
      $bracelevel--;
    }
    elseif ($val[$i] == '#' && !$openquote && !$bracelevel) {
      $strings[] = substr($val, $j, $i - $j);
      $j = $i + 1;
    }
    $i++;
  }
  $strings[] = substr($val, $j);
  return $strings;
}