Subj : String concat problem To : netscape.public.mozilla.jseng From : Niklas Lindquist Date : Tue Apr 20 2004 03:19 pm I have created a class exposing a string property. It works like a charm, except when it comes to using it to build longer strings. In JavaScript: s = myobj.name; s = 'Pre: ' + myobj.name; s = myobj.name.length + ' post'; all works fine, but: s = myobj.name + ' post'; only returns the name property and doesn't concatenate it with ' post'. I can run toLowerCase() and similar functions on my string, so it seems to be correct. I have initialized my string in the getProperty hook: int length = ::strlen(pDoc->getName()) + 1; char* buffer = reinterpret_cast(::JS_malloc(cx, length)); ::strcpy(buffer, pDoc->getName()); JSString *str = ::JS_NewString(cx, buffer, length); *vp = STRING_TO_JSVAL(str); Have I missed something? .