class String
Defined at line 63 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-string.h
String - an abstract class holding static string utilities.
Public Methods
const char * CloneCString (const char * c_str)
Clones a 0-terminated C string, allocating memory using new. The
caller is responsible for deleting the return value using
delete[]. Returns the cloned string, or NULL if the input is
NULL.
This is different from strdup() in string.h, which allocates
memory using malloc().
bool CStringEquals (const char * lhs, const char * rhs)
Compares two C strings. Returns true if and only if they have the same
content.
Unlike strcmp(), this function can handle NULL argument(s). A
NULL C string is considered different to any non-NULL C string,
including the empty string.
std::string ShowWideCString (const wchar_t * wide_c_str)
Converts a wide C string to a String using the UTF-8 encoding.
NULL will be converted to "(null)". If an error occurred during
the conversion, "(failed to convert from wide string)" is
returned.
bool WideCStringEquals (const wchar_t * lhs, const wchar_t * rhs)
Compares two wide C strings. Returns true if and only if they have the
same content.
Unlike wcscmp(), this function can handle NULL argument(s). A
NULL C string is considered different to any non-NULL C string,
including the empty string.
bool CaseInsensitiveCStringEquals (const char * lhs, const char * rhs)
Compares two C strings, ignoring case. Returns true if and only if
they have the same content.
Unlike strcasecmp(), this function can handle NULL argument(s).
A NULL C string is considered different to any non-NULL C string,
including the empty string.
bool CaseInsensitiveWideCStringEquals (const wchar_t * lhs, const wchar_t * rhs)
Compares two wide C strings, ignoring case. Returns true if and only if
they have the same content.
Unlike wcscasecmp(), this function can handle NULL argument(s).
A NULL C string is considered different to any non-NULL wide C string,
including the empty string.
NB: The implementations on different platforms slightly differ.
On windows, this method uses _wcsicmp which compares according to LC_CTYPE
environment variable. On GNU platform this method uses wcscasecmp
which compares according to LC_CTYPE category of the current locale.
On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
current locale.
bool EndsWithCaseInsensitive (const std::string & str, const std::string & suffix)
Returns true if and only if the given string ends with the given suffix,
ignoring case. Any string is considered to end with an empty suffix.
std::string FormatIntWidth2 (int value)
Formats an int value as "%02d".
std::string FormatIntWidthN (int value, int width)
Formats an int value to given width with leading zeros.
std::string FormatHexInt (int value)
Formats an int value as "%X".
std::string FormatHexUInt32 (uint32_t value)
Formats an int value as "%X".
std::string FormatByte (unsigned char value)
Formats a byte as "%02X".