protected function EasyRdf_Serialiser_Turtle::quotedString

@ignore

1 call to EasyRdf_Serialiser_Turtle::quotedString()
EasyRdf_Serialiser_Turtle::serialiseObject in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php
@ignore

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php, line 75

Class

EasyRdf_Serialiser_Turtle
Class to serialise an EasyRdf_Graph to Turtle with no external dependancies.

Code

protected function quotedString($value) {
  if (preg_match("/[\t\n\r]/", $value)) {
    $escaped = str_replace(array(
      '\\',
      '"""',
    ), array(
      '\\\\',
      '\\"""',
    ), $value);
    return '"""' . $escaped . '"""';
  }
  else {
    $escaped = str_replace(array(
      '\\',
      '"',
    ), array(
      '\\\\',
      '\\"',
    ), $value);
    return '"' . $escaped . '"';
  }
}