login about faq

I've got a Unicode string I'd like to split using split2WS, however it returns a CkStringArray not a CkStringArrayW.. Is there a more appropriate way to do this so I get a CkStringArrayW? I have searched and can't find a method that returns a Unicode string array.

Thanks!

M

asked Feb 13 at 11:37

mmshann's gravatar image

mmshann
1


This was an oversight when adding the function to the library. (What the heck was I thinking???)

Anyway, it can't be changed now, so here's a workaround:

    CkStringArray sa;

sa.Append("apple");
sa.Append("orange");
sa.Append("pear");

// Get Unicode strings from sa.

// First, tell the CkStringArray object to return utf-8
sa.put_Utf8(true);

CkString strTemp;
int i;
for (i=0; i<sa.get_Count(); i++)
{
const char *strUtf8 = sa.getString(i);
strTemp.setStringUtf8(strUtf8);
const wchar_t *wideStr = strTemp.getUnicode();
// Note: wideStr points to internal memory within strTemp.  Make sure to copy the wide string 
// to a safe place, unless the app uses it only while strTemp remains in existence and is not modified.
}
link

answered Feb 15 at 10:52

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Feb 15 at 10:53

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6

Asked: Feb 13 at 11:37

Seen: 416 times

Last updated: Feb 15 at 10:53

powered by OSQA