Strings

Suppose i want to get the data out of a string, do something with it and put it back.

this sort of works. however, can i be assued to put the data back as CharPointer_UTF8 (if i use wchar_t* it doesnt work).

[code]String ts;

SimpleString ss(ts.getCharPointer());
ss.doSomeThing();
ts = String(CharPoineter_UTF8((const char*)ss));
[/code]

Also, suppse i dont want any ascii/unicode/utf8 conversions, i’m just doing something with the raw data and then i want to put it back without any subsequent conversion.

?

Well, not sure I’d recommend messing with the data in-place, unless you’re definitely not going to change its length or damage the utf-8 encoding. Best to create a memory block of your own containing your new data (i.e. a HeapBlock of CharPointer_UTF8, CharPointer_UTF16, etc), and then construct a string from the result.

To get the raw data out, toUTF8().getAddress() will get you a pointer to the data without doing any conversion work - it’s safe to assume strings will always be stored as utf-8 internally.

That’s what i need to know, thanks. No i’m not changing the data in place, just that i wanted to get raw data out, change it and make a new string from it without any internal conversion.