| Version: 3.2.5

Public Member Functions | Static Public Member Functions | List of all members
wxUString Class Reference
Class List by Category » Data Structures

`#include <wx/ustring.h>`

Inheritance diagram for wxUString:
[legend]

## Detailed Description

wxUString is a class representing a Unicode character string where each character is stored using a 32-bit value.

This is different from wxString which may store a character either as a UTF-8 or as a UTF-16 sequence and different from `std::string` which stores a string as a sequence of simple 8-bit characters and also different from `std::wstring` which stores the string differently depending on the definition of wchar_t.

The main purpose of wxUString is a to give users a Unicode string class that has O(1) access to its content, to be identical on all platforms and to be easily convertible to wxString as well as other ways to store strings (C string literals, wide character string literals, character buffer, etc) by providing several overloads and built-in conversions to and from the various string formats.

wxUString derives from `std::basic_string<wxChar32>` and therefore offers the complete API of `std::string`.

##

Library: wxBase
Category: Data Structures

See also
  wxString, wxString overview, Unicode overview

## Public Member Functions

| wxUString ()
| Default constructor. More...
| wxUString (const wxUString &str)
| Copy constructor. More...
| wxUString (const wxChar32 *str)
| Constructs a string from a 32-bit string literal. More...
| wxUString (const wxU32CharBuffer &buf)
| Constructs a string from 32-bit string buffer. More...
| wxUString (const char *str)
| Constructs a string from C string literal using wxConvLibc to convert it to Unicode. More...
| wxUString (const wxCharBuffer &buf)
| Constructs a string from C string buffer using wxConvLibc to convert it to Unicode. More...
| wxUString (const char *str, const wxMBConv &conv)
| Constructs a string from C string literal using conv to convert it to Unicode. More...
| wxUString (const wxCharBuffer &buf, const wxMBConv &conv)
| Constructs a string from C string literal using conv to convert it to Unicode. More...
| wxUString (const wxChar16 *str)
| Constructs a string from UTF-16 string literal. More...
| wxUString (const wxU16CharBuffer &buf)
| Constructs a string from UTF-16 string buffer. More...
| wxUString (const wxString &str)
| Constructs a string from wxString. More...
| wxUString (char ch)
| Constructs a string from using wxConvLibc to convert it to Unicode. More...
| wxUString (wxChar16 ch)
| Constructs a string from a UTF-16 character. More...
| wxUString (wxChar32 ch)
| Constructs a string from 32-bit Unicode character. More...
| wxUString (wxUniChar ch)
| Constructs a string from wxUniChar (returned by wxString's access operator) More...
| wxUString (wxUniCharRef ch)
| Constructs a string from wxUniCharRef (returned by wxString's access operator) More...
| wxUString (size_t n, char ch)
| Constructs a string from n characters ch. More...
| wxUString (size_t n, wxChar16 ch)
| Constructs a string from n characters ch. More...
| wxUString (size_t n, wxChar32 ch)
| Constructs a string from n characters ch. More...
| wxUString (size_t n, wxUniChar ch)
| Constructs a string from n characters ch. More...
| wxUString (size_t n, wxUniCharRef ch)
| Constructs a string from n characters ch. More...
wxUString & | assignFromAscii (const char *str)
| Assignment from a 7-bit ASCII string literal. More...
wxUString & | assignFromAscii (const char *str, size_t n)
| Assignment from a 7-bit ASCII string literal. More...
wxUString & | assignFromUTF8 (const char *str)
| Assignment from a UTF-8 string literal. More...
wxUString & | assignFromUTF8 (const char *str, size_t n)
| Assignment from a UTF-8 string literal. More...
wxUString & | assignFromUTF16 (const wxChar16 *str)
| Assignment from a UTF-16 string literal. More...
wxUString & | assignFromUTF16 (const wxChar16 *str, size_t n)
| Assignment from a UTF-16 string literal. More...
wxUString & | assignFromCString (const char *str)
| Assignment from a C string literal using wxConvLibc. More...
wxUString & | assignFromCString (const char *str, const wxMBConv &conv)
| Assignment from a C string literal using conv. More...
wxCharBuffer | utf8_str () const
| Conversion to a UTF-8 string. More...
wxU16CharBuffer | utf16_str () const
| Conversion to a UTF-16 string. More...
wxWCharBuffer | wc_str () const
| Conversion to a wide character string (either UTF-16 or UCS-4, depending on the size of wchar_t). More...
| operator wxString () const
| Implicit conversion to wxString. More...
wxUString & | assign (const wxUString &str)
| wxUString assignment. More...
wxUString & | append (const wxUString &s)
| Appending. More...
wxUString & | insert (size_t pos, const wxUString &s)
| Insertion. More...
wxUString & | operator= (const wxUString &s)
| Assignment operator. More...
wxUString & | operator+= (const wxUString &s)
| Concatenation operator. More...

## Static Public Member Functions

static wxUString | FromAscii (const char *str, size_t n)
| Static construction of a wxUString from a 7-bit ASCII string. More...
static wxUString | FromAscii (const char *str)
| Static construction of a wxUString from a 7-bit ASCII string. More...
static wxUString | FromUTF8 (const char *str, size_t n)
| Static construction of a wxUString from a UTF-8 encoded string. More...
static wxUString | FromUTF8 (const char *str)
| Static construction of a wxUString from a UTF-8 encoded string. More...
static wxUString | FromUTF16 (const wxChar16 *str, size_t n)
| Static construction of a wxUString from a UTF-16 encoded string. More...
static wxUString | FromUTF16 (const wxChar16 *str)
| Static construction of a wxUString from a UTF-16 encoded string. More...

## Constructor & Destructor Documentation

## ◆ wxUString() [1/21]

wxUString::wxUString | ( |  | ) |

Default constructor.

## ◆ wxUString() [2/21]

wxUString::wxUString | ( | const wxUString & | str | ) |

Copy constructor.

## ◆ wxUString() [3/21]

wxUString::wxUString | ( | const wxChar32 * | str | ) |

Constructs a string from a 32-bit string literal.

## ◆ wxUString() [4/21]

wxUString::wxUString | ( | const wxU32CharBuffer & | buf | ) |

Constructs a string from 32-bit string buffer.

## ◆ wxUString() [5/21]

wxUString::wxUString | ( | const char * | str | ) |

Constructs a string from C string literal using wxConvLibc to convert it to Unicode.

## ◆ wxUString() [6/21]

wxUString::wxUString | ( | const wxCharBuffer & | buf | ) |

Constructs a string from C string buffer using wxConvLibc to convert it to Unicode.

## ◆ wxUString() [7/21]

wxUString::wxUString | ( | const char * | str,
|  | const wxMBConv & | conv
| ) |  |

Constructs a string from C string literal using conv to convert it to Unicode.

## ◆ wxUString() [8/21]

wxUString::wxUString | ( | const wxCharBuffer & | buf,
|  | const wxMBConv & | conv
| ) |  |

Constructs a string from C string literal using conv to convert it to Unicode.

## ◆ wxUString() [9/21]

wxUString::wxUString | ( | const wxChar16 * | str | ) |

Constructs a string from UTF-16 string literal.

## ◆ wxUString() [10/21]

wxUString::wxUString | ( | const wxU16CharBuffer & | buf | ) |

Constructs a string from UTF-16 string buffer.

## ◆ wxUString() [11/21]

wxUString::wxUString | ( | const wxString & | str | ) |

Constructs a string from wxString.

## ◆ wxUString() [12/21]

wxUString::wxUString | ( | char | ch | ) |

Constructs a string from using wxConvLibc to convert it to Unicode.

## ◆ wxUString() [13/21]

wxUString::wxUString | ( | wxChar16 | ch | ) |

Constructs a string from a UTF-16 character.

## ◆ wxUString() [14/21]

wxUString::wxUString | ( | wxChar32 | ch | ) |

Constructs a string from 32-bit Unicode character.

## ◆ wxUString() [15/21]

wxUString::wxUString | ( | wxUniChar | ch | ) |

Constructs a string from wxUniChar (returned by wxString's access operator)

## ◆ wxUString() [16/21]

wxUString::wxUString | ( | wxUniCharRef | ch | ) |

Constructs a string from wxUniCharRef (returned by wxString's access operator)

## ◆ wxUString() [17/21]

wxUString::wxUString | ( | size_t | n,
|  | char | ch
| ) |  |

Constructs a string from n characters ch.

## ◆ wxUString() [18/21]

wxUString::wxUString | ( | size_t | n,
|  | wxChar16 | ch
| ) |  |

Constructs a string from n characters ch.

## ◆ wxUString() [19/21]

wxUString::wxUString | ( | size_t | n,
|  | wxChar32 | ch
| ) |  |

Constructs a string from n characters ch.

## ◆ wxUString() [20/21]

wxUString::wxUString | ( | size_t | n,
|  | wxUniChar | ch
| ) |  |

Constructs a string from n characters ch.

## ◆ wxUString() [21/21]

wxUString::wxUString | ( | size_t | n,
|  | wxUniCharRef | ch
| ) |  |

Constructs a string from n characters ch.

## Member Function Documentation

## ◆ append()

wxUString& wxUString::append | ( | const wxUString & | s | ) |

Appending.

wxUString additionally provides overloads for wxString, C string, UTF-16 strings, 32-bit strings, char buffers, single and repeated characters etc.

## ◆ assign()

wxUString& wxUString::assign | ( | const wxUString & | str | ) |

wxUString assignment.

wxUString additionally provides overloads for wxString, C string, UTF-16 strings, 32-bit strings, char buffers, single and repeated characters etc.

## ◆ assignFromAscii() [1/2]

wxUString& wxUString::assignFromAscii | ( | const char * | str | ) |

Assignment from a 7-bit ASCII string literal.

## ◆ assignFromAscii() [2/2]

wxUString& wxUString::assignFromAscii | ( | const char * | str,
|  | size_t | n
| ) |  |

Assignment from a 7-bit ASCII string literal.

## ◆ assignFromCString() [1/2]

wxUString& wxUString::assignFromCString | ( | const char * | str | ) |

Assignment from a C string literal using wxConvLibc.

## ◆ assignFromCString() [2/2]

wxUString& wxUString::assignFromCString | ( | const char * | str,
|  | const wxMBConv & | conv
| ) |  |

Assignment from a C string literal using conv.

## ◆ assignFromUTF16() [1/2]

wxUString& wxUString::assignFromUTF16 | ( | const wxChar16 * | str | ) |

Assignment from a UTF-16 string literal.

## ◆ assignFromUTF16() [2/2]

wxUString& wxUString::assignFromUTF16 | ( | const wxChar16 * | str,
|  | size_t | n
| ) |  |

Assignment from a UTF-16 string literal.

## ◆ assignFromUTF8() [1/2]

wxUString& wxUString::assignFromUTF8 | ( | const char * | str | ) |

Assignment from a UTF-8 string literal.

## ◆ assignFromUTF8() [2/2]

wxUString& wxUString::assignFromUTF8 | ( | const char * | str,
|  | size_t | n
| ) |  |

Assignment from a UTF-8 string literal.

## ◆ FromAscii() [1/2]

static wxUString wxUString::FromAscii | ( | const char * | str | ) |

static

Static construction of a wxUString from a 7-bit ASCII string.

## ◆ FromAscii() [2/2]

static wxUString wxUString::FromAscii | ( | const char * | str,
|  | size_t | n
| ) |  |

static

Static construction of a wxUString from a 7-bit ASCII string.

## ◆ FromUTF16() [1/2]

static wxUString wxUString::FromUTF16 | ( | const wxChar16 * | str | ) |

static

Static construction of a wxUString from a UTF-16 encoded string.

## ◆ FromUTF16() [2/2]

static wxUString wxUString::FromUTF16 | ( | const wxChar16 * | str,
|  | size_t | n
| ) |  |

static

Static construction of a wxUString from a UTF-16 encoded string.

## ◆ FromUTF8() [1/2]

static wxUString wxUString::FromUTF8 | ( | const char * | str | ) |

static

Static construction of a wxUString from a UTF-8 encoded string.

## ◆ FromUTF8() [2/2]

static wxUString wxUString::FromUTF8 | ( | const char * | str,
|  | size_t | n
| ) |  |

static

Static construction of a wxUString from a UTF-8 encoded string.

## ◆ insert()

wxUString& wxUString::insert | ( | size_t | pos,
|  | const wxUString & | s
| ) |  |

Insertion.

wxUString additionally provides overloads for wxString, C string, UTF-16 strings, 32-bit strings, char buffers, single characters etc.

## ◆ operator wxString()

wxUString::operator wxString | ( |  | ) | const

Implicit conversion to wxString.

## ◆ operator+=()

wxUString& wxUString::operator+= | ( | const wxUString & | s | ) |

inline

Concatenation operator.

wxUString additionally provides overloads for wxString, C string, UTF-16 strings, 32-bit strings, char buffers, single characters etc.

## ◆ operator=()

wxUString& wxUString::operator= | ( | const wxUString & | s | ) |

inline

Assignment operator.

wxUString additionally provides overloads for wxString, C string, UTF-16 strings, 32-bit strings, char buffers, single characters etc.

## ◆ utf16_str()

wxU16CharBuffer wxUString::utf16_str | ( |  | ) | const

Conversion to a UTF-16 string.

## ◆ utf8_str()

wxCharBuffer wxUString::utf8_str | ( |  | ) | const

Conversion to a UTF-8 string.

## ◆ wc_str()

wxWCharBuffer wxUString::wc_str | ( |  | ) | const

Conversion to a wide character string (either UTF-16 or UCS-4, depending on the size of wchar_t).