Converts String to a different encoding (UTF8, UTF16). More...
#include <StringConverter.h>
Public Types | |
| enum | StringTermination { NullTerminate , DoNotTerminate } |
| Specifies if to add a null terminator. More... | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | appendEncodingTo (StringEncoding encoding, StringSpan text, T &buffer, StringTermination nullTerminate) |
| Appends to buffer text with requested encoding, optionally null-terminating it too. | |
| static bool | appendEncodingTo (StringEncoding encoding, StringSpan text, IGrowableBuffer &buffer, StringTermination nullTerminate) |
Converts String to a different encoding (UTF8, UTF16).
SC::StringConverter converts strings between different UTF encodings and can add null-terminator if requested. When the SC::StringSpan is already null-terminated, the class just forwards the original SC::StringSpan.
Example:
|
inlinestaticnodiscard |
Appends to buffer text with requested encoding, optionally null-terminating it too.
| encoding | The requested destination encoding to convert to |
| text | The StringSpan to be converted |
| buffer | Encoded text will be appended to buffer |
| nullTerminate | Specifies if the StringSpan will need to be null terminated or not |
true if the conversion succeeds