I’m converting some code from an older version of juce, where I could do a copyFromBuffer() to extract a char from a String.
My replacement code looks like this:
String theTestString = ";";
CharPointer_UTF8::CharType theUTF8String;
int theStringLength = theTestString.getNumBytesAsUTF8();
theTestString.copyToUTF8(&theUTF8String, theStringLength);
Sadly, theUTF8String is empty after doing this.
Maybe someone out there can point out the error of my ways…
It looks as if the correct character is extracted by copyWithDestByteLimit(), but then, because the maxBytes value was decremented both before and after the read, the routine exits without assigning the read value to the return variable.