There is only one String type in V8 which is v8::String. You can create an
new String in a number of ways with v8::String::New most commonly used. The
classes  v8::String::Utf8Value
and v8::String::Value (and v8::String::AsciiValue which is mainly for
testing) are used to pull out the string as a char* or uint16_t* to be used
in C++, e.g.:
  v8::Handle<v8::String> str = v8::String::New("print")
  v8::String::Utf8Value s(str);
  printf("%s", *s);

Note that v8::String represents the string value (ECMA-262 4.3.16). To
create a string object (ECMA-262 4.3.18) use NewInstance on the String
function.

Regards,
Søren


On Thu, Oct 2, 2008 at 11:00 PM, ondras <[EMAIL PROTECTED]> wrote:

>
> Hi again,
>
> I have some troubles understanding all those String types in V8. What
> exactly is the purpose and difference between v8::String::New,
> v8::String::AsciiValue and v8::String::Utf8Value? How should I use
> these and when?
>
> Thanks for clarification,
> Ondrej
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to