tags:

views:

17

answers:

2

As of ICU 4.2.1, the only straight-forward way to set a UnicodeString to a C string is to construct a new UnicodeString with the data, and then set the desired string to the new one, thus allocating, copying, and deallocating data more than I'd like.

Is there a way to set a UnicodeString to a (null-terminated/length) C string without having to allocate data manually?

Maybe in a newer version of ICU? (I haven't checked the documentation for any version other than 4.2.1, and that is the most recent version on my distro.)

It seems like something that should be a setTo(const char*) method, seeing as you can construct a UnicodeString with a C string.

+1  A: 

I don't see a way to do that, I'd file a feature request for setTo - or even contribute a patch for it!

Steven R. Loomis