## String functions

::copystring
::wxIsEmpty
::wxStricmp
::wxStringMatch
::wxStringEq
::wxStrlen
::wxGetTranslation
::wxSnprintf
::wxToLower
::wxToUpper
::wxVsnprintf

### ::copystring

char * copystring(const char *s)

Makes a copy of the string s using the C++ new operator, so it can be deleted with the delete operator.

This function is deprecated, use wxString class instead.

### ::wxIsEmpty

bool wxIsEmpty(const char * p)

Returns `TRUE` if the pointer is either `NULL` or points to an empty string, `FALSE` otherwise.

### ::wxStricmp

int wxStricmp(const char *p1, const char *p2)

Returns a negative value, 0, or positive value if p1 is less than, equal to or greater than p2. The comparison is case-insensitive.

This function complements the standard C function strcmp() which performs case-sensitive comparison.

### ::wxStringMatch

bool wxStringMatch(const wxString& s1, const wxString& s2,
bool subString = TRUE, bool exact = FALSE)

NB: This function is obsolete, use wxString::Find instead.

Returns `TRUE` if the substring s1 is found within s2, ignoring case if exact is FALSE. If subString is `FALSE`, no substring matching is done.

### ::wxStringEq

bool wxStringEq(const wxString& s1, const wxString& s2)

NB: This function is obsolete, use wxString instead.

A macro defined as:

    #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))

### ::wxStrlen

size_t wxStrlen(const char * p)

This is a safe version of standard function strlen(): it does exactly the same thing (i.e. returns the length of the string) except that it returns 0 if p is the `NULL` pointer.

### ::wxGetTranslation

const char * wxGetTranslation(const char * str)

This function returns the translation of string str in the current locale. If the string is not found in any of the loaded message catalogs (see internationalization overview), the original string is returned. In debug build, an error message is logged - this should help to find the strings which were not yet translated. As this function is used very often, an alternative syntax is provided: the _() macro is defined as wxGetTranslation().

### ::wxSnprintf

int wxSnprintf(wxChar *buf, size_t len, const wxChar *format, ...)

This function replaces the dangerous standard function `sprintf()` and is like `snprintf()` available on some platforms. The only difference with sprintf() is that an additional argument - buffer size - is taken and the buffer is never overflowed.

Returns the number of characters copied to the buffer or -1 if there is not enough space.

See also

wxVsnprintf, wxString::Printf

### ::wxToLower

char wxToLower(char ch)

Converts the character to lower case. This is implemented as a macro for efficiency.

Include files

<wx/utils.h>

### ::wxToUpper

char wxToUpper(char ch)

Converts the character to upper case. This is implemented as a macro for efficiency.

Include files

<wx/utils.h>

### ::wxVsnprintf

int wxVsnprintf(wxChar *buf, size_t len, const wxChar *format, va_list argPtr)

The same as wxSnprintf but takes a `va_list` argument instead of arbitrary number of parameters.

See also

wxSnprintf, wxString::PrintfV