A function to handle multiple datatypes

PaulS:
Though why one would want to do this is unclear.

That depends which representation of the string we're talking about. It's reasonable to expect strings to be null-terminated in memory, but I wouldn't normally expect the terminator to be persisted or serialised.