ported base string functions to C++