JE::String - JavaScript string value


JE documentation  | view source Contained in the JE distribution.

Index


NAME

Top

JE::String - JavaScript string value

SYNOPSIS

Top

  use JE;
  use JE::String;

  $j = JE->new;

  $js_str = new JE::String $j, "etetfyoyfoht";

  $perl_str = $js_str->value;

  $js_str->to_object; # retuns a new JE::String::Object;

DESCRIPTION

Top

This class implements JavaScript string values for JE. The difference in use between this and JE::Object::String is that that module implements string objects, while this module implements the primitive values.

The stringification operator is overloaded.

THE FUNCTION

Top

There are two exportable functions, surrogify and desurrogify, which convert characters outside the BMP into surrogate pairs, and convert surrogate pairs in the string input argument into the characters they represent, respectively, and return the modified string. E.g.:

  use JE::String qw 'desurrogify surrogify';

  {
          no warnings 'utf8';
          $str = "\x{d834}\x{dd2b}";
  }

  $str = desurrogify $str;  # $str now contains "\x{1d12b}" (double flat)
  $str = surrogify $str;    # back to "\x{d834}\x{dd2b}"

SEE ALSO

Top

JE
JE::Types
JE::Object::String

JE documentation  | view source Contained in the JE distribution.