LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
|
This String class provides base functionality for C++ like Unicode character array handling. More...
#include <ustring.hxx>
Public Member Functions | |
OUString () | |
New string containing no characters. More... | |
OUString (const OUString &str) | |
New string from OUString. More... | |
OUString (rtl_uString *str) | |
New string from OUString data. More... | |
OUString (rtl_uString *str, __sal_NoAcquire) | |
New OUString from OUString data without acquiring it. More... | |
OUString (sal_Unicode value) | |
New string from a single Unicode character. More... | |
OUString (const sal_Unicode *value) | |
New string from a Unicode character buffer array. More... | |
OUString (const sal_Unicode *value, sal_Int32 length) | |
New string from a Unicode character buffer array. More... | |
template<typename T > | |
OUString (T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy()) | |
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set (i.e. More... | |
OUString (const char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS) | |
New string from an 8-Bit character buffer array. More... | |
OUString (sal_uInt32 const *codePoints, sal_Int32 codePointCount) | |
Create a new string from an array of Unicode code points. More... | |
~OUString () | |
Release the string data. More... | |
OUString & | operator= (const OUString &str) |
Assign a new string. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, OUString &>::Type | operator= (T &literal) |
Assign a new string from an 8-Bit string literal that is expected to contain only characters in the ASCII set (i.e. More... | |
OUString & | operator+= (const OUString &str) |
Append a string to this string. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, OUString & >::Type | operator+= (T &literal) |
Append an ASCII string literal to this string. More... | |
void | clear () |
Clears the string, i.e, makes a zero-character string. More... | |
sal_Int32 | getLength () const |
Returns the length of this string. More... | |
bool | isEmpty () const |
Checks if a string is empty. More... | |
const sal_Unicode * | getStr () const SAL_RETURNS_NONNULL |
Returns a pointer to the Unicode character buffer for this string. More... | |
sal_Unicode | operator[] (sal_Int32 index) const |
Access to individual characters. More... | |
sal_Int32 | compareTo (const OUString &str) const |
Compares two strings. More... | |
sal_Int32 | compareTo (const OUString &str, sal_Int32 maxLength) const |
Compares two strings with a maximum count of characters. More... | |
sal_Int32 | reverseCompareTo (const OUString &str) const |
Compares two strings in reverse order. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type | reverseCompareTo (T &literal) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | equals (const OUString &str) const |
Perform a comparison of two strings. More... | |
bool | equalsIgnoreAsciiCase (const OUString &str) const |
Perform an ASCII lowercase comparison of two strings. More... | |
sal_Int32 | compareToIgnoreAsciiCase (const OUString &str) const |
Perform an ASCII lowercase comparison of two strings. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | equalsIgnoreAsciiCase (T &literal) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | match (const OUString &str, sal_Int32 fromIndex=0) const |
Match against a substring appearing in this string. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | match (T &literal, sal_Int32 fromIndex=0) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | matchIgnoreAsciiCase (const OUString &str, sal_Int32 fromIndex=0) const |
Match against a substring appearing in this string, ignoring the case of ASCII letters. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | matchIgnoreAsciiCase (T &literal, sal_Int32 fromIndex=0) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
sal_Int32 | compareToAscii (const char *asciiStr) const |
Compares two strings. More... | |
sal_Int32 | compareToAscii (const char *asciiStr, sal_Int32 maxLength) const |
Compares two strings with a maximum count of characters. More... | |
sal_Int32 | reverseCompareToAsciiL (const char *asciiStr, sal_Int32 asciiStrLength) const |
Compares two strings in reverse order. More... | |
bool | equalsAscii (const char *asciiStr) const |
Perform a comparison of two strings. More... | |
bool | equalsAsciiL (const char *asciiStr, sal_Int32 asciiStrLength) const |
Perform a comparison of two strings. More... | |
bool | equalsIgnoreAsciiCaseAscii (const char *asciiStr) const |
Perform an ASCII lowercase comparison of two strings. More... | |
sal_Int32 | compareToIgnoreAsciiCaseAscii (const char *asciiStr) const |
Compares two ASCII strings ignoring case. More... | |
bool | equalsIgnoreAsciiCaseAsciiL (const char *asciiStr, sal_Int32 asciiStrLength) const |
Perform an ASCII lowercase comparison of two strings. More... | |
bool | matchAsciiL (const char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const |
Match against a substring appearing in this string. More... | |
bool | matchIgnoreAsciiCaseAsciiL (const char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const |
Match against a substring appearing in this string, ignoring the case of ASCII letters. More... | |
bool | startsWith (OUString const &str, OUString *rest=NULL) const |
Check whether this string starts with a given substring. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | startsWith (T &literal, OUString *rest=NULL) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | startsWithIgnoreAsciiCase (OUString const &str, OUString *rest=NULL) const |
Check whether this string starts with a given string, ignoring the case of ASCII letters. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | startsWithIgnoreAsciiCase (T &literal, OUString *rest=NULL) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | endsWith (OUString const &str, OUString *rest=NULL) const |
Check whether this string ends with a given substring. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | endsWith (T &literal, OUString *rest=NULL) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | endsWithAsciiL (char const *asciiStr, sal_Int32 asciiStrLength) const |
Check whether this string ends with a given ASCII string. More... | |
bool | endsWithIgnoreAsciiCase (OUString const &str, OUString *rest=NULL) const |
Check whether this string ends with a given string, ignoring the case of ASCII letters. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | endsWithIgnoreAsciiCase (T &literal, OUString *rest=NULL) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
bool | endsWithIgnoreAsciiCaseAsciiL (char const *asciiStr, sal_Int32 asciiStrLength) const |
Check whether this string ends with a given ASCII string, ignoring the case of ASCII letters. More... | |
sal_Int32 | hashCode () const |
Returns a hashcode for this string. More... | |
sal_Int32 | indexOf (sal_Unicode ch, sal_Int32 fromIndex=0) const |
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. More... | |
sal_Int32 | lastIndexOf (sal_Unicode ch) const |
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end. More... | |
sal_Int32 | lastIndexOf (sal_Unicode ch, sal_Int32 fromIndex) const |
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index. More... | |
sal_Int32 | indexOf (const OUString &str, sal_Int32 fromIndex=0) const |
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type | indexOf (T &literal, sal_Int32 fromIndex=0) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
sal_Int32 | indexOfAsciiL (char const *str, sal_Int32 len, sal_Int32 fromIndex=0) const |
Returns the index within this string of the first occurrence of the specified ASCII substring, starting at the specified index. More... | |
sal_Int32 | lastIndexOf (const OUString &str) const |
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end. More... | |
sal_Int32 | lastIndexOf (const OUString &str, sal_Int32 fromIndex) const |
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type | lastIndexOf (T &literal) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument. More... | |
sal_Int32 | lastIndexOfAsciiL (char const *str, sal_Int32 len) const |
Returns the index within this string of the last occurrence of the specified ASCII substring. More... | |
SAL_WARN_UNUSED_RESULT OUString | copy (sal_Int32 beginIndex) const |
Returns a new string that is a substring of this string. More... | |
SAL_WARN_UNUSED_RESULT OUString | copy (sal_Int32 beginIndex, sal_Int32 count) const |
Returns a new string that is a substring of this string. More... | |
SAL_WARN_UNUSED_RESULT OUString | concat (const OUString &str) const |
Concatenates the specified string to the end of this string. More... | |
SAL_WARN_UNUSED_RESULT OUString | replaceAt (sal_Int32 index, sal_Int32 count, const OUString &newStr) const |
Returns a new string resulting from replacing n = count characters from position index in this string with newStr. More... | |
SAL_WARN_UNUSED_RESULT OUString | replace (sal_Unicode oldChar, sal_Unicode newChar) const |
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar. More... | |
SAL_WARN_UNUSED_RESULT OUString | replaceFirst (OUString const &from, OUString const &to, sal_Int32 *index=NULL) const |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring. More... | |
template<typename T > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type | replaceFirst (T &from, OUString const &to, sal_Int32 *index=NULL) const |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring. More... | |
template<typename T > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type | replaceFirst (OUString const &from, T &to, sal_Int32 *index=NULL) const |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring. More... | |
template<typename T1 , typename T2 > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type | replaceFirst (T1 &from, T2 &to, sal_Int32 *index=NULL) const |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring. More... | |
SAL_WARN_UNUSED_RESULT OUString | replaceAll (OUString const &from, OUString const &to, sal_Int32 fromIndex=0) const |
Returns a new string resulting from replacing all occurrences of a given substring with another substring. More... | |
template<typename T > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type | replaceAll (T &from, OUString const &to) const |
Returns a new string resulting from replacing all occurrences of a given substring with another substring. More... | |
template<typename T > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type | replaceAll (OUString const &from, T &to) const |
Returns a new string resulting from replacing all occurrences of a given substring with another substring. More... | |
template<typename T1 , typename T2 > | |
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type | replaceAll (T1 &from, T2 &to) const |
Returns a new string resulting from replacing all occurrences of a given substring with another substring. More... | |
SAL_WARN_UNUSED_RESULT OUString | toAsciiLowerCase () const |
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-122). More... | |
SAL_WARN_UNUSED_RESULT OUString | toAsciiUpperCase () const |
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-90). More... | |
SAL_WARN_UNUSED_RESULT OUString | trim () const |
Returns a new string resulting from removing white space from both ends of the string. More... | |
OUString | getToken (sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const |
Returns a token in the string. More... | |
OUString | getToken (sal_Int32 count, sal_Unicode separator) const |
Returns a token from the string. More... | |
bool | toBoolean () const |
Returns the Boolean value from this string. More... | |
sal_Unicode | toChar () const |
Returns the first character from this string. More... | |
sal_Int32 | toInt32 (sal_Int16 radix=10) const |
Returns the int32 value from this string. More... | |
sal_uInt32 | toUInt32 (sal_Int16 radix=10) const |
Returns the uint32 value from this string. More... | |
sal_Int64 | toInt64 (sal_Int16 radix=10) const |
Returns the int64 value from this string. More... | |
sal_uInt64 | toUInt64 (sal_Int16 radix=10) const |
Returns the uint64 value from this string. More... | |
float | toFloat () const |
Returns the float value from this string. More... | |
double | toDouble () const |
Returns the double value from this string. More... | |
OUString | intern () const |
Return a canonical representation for a string. More... | |
bool | convertToString (OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const |
Converts to an OString, signalling failure. More... | |
sal_uInt32 | iterateCodePoints (sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints=1) const |
Iterate through this string based on code points instead of UTF-16 code units. More... | |
OString | toUtf8 () const |
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully. More... | |
Static Public Member Functions | |
static OUString const & | unacquired (rtl_uString *const *ppHandle) |
Provides an OUString const & passing a storage pointer of an rtl_uString * handle. More... | |
static OUString | intern (const char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS, sal_uInt32 *pInfo=NULL) |
Return a canonical representation for a converted string. More... | |
static OUString | fromUtf8 (const OString &rSource) |
Convert an OString to an OUString, assuming that the OString is UTF-8-encoded. More... | |
static OUString | number (int i, sal_Int16 radix=10) |
Returns the string representation of the integer argument. More... | |
static OUString | number (unsigned int i, sal_Int16 radix=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static OUString | number (long i, sal_Int16 radix=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static OUString | number (unsigned long i, sal_Int16 radix=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static OUString | number (long long ll, sal_Int16 radix=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static OUString | number (unsigned long long ll, sal_Int16 radix=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
static OUString | number (float f) |
Returns the string representation of the float argument. More... | |
static OUString | number (double d) |
Returns the string representation of the double argument. More... | |
static OUString | valueOf (sal_Bool b) |
Returns the string representation of the sal_Bool argument. More... | |
static OUString | boolean (bool b) |
Returns the string representation of the boolean argument. More... | |
static OUString | valueOf (sal_Unicode c) |
Returns the string representation of the char argument. More... | |
static OUString | valueOf (sal_Int32 i, sal_Int16 radix=10) |
Returns the string representation of the int argument. More... | |
static OUString | valueOf (sal_Int64 ll, sal_Int16 radix=10) |
Returns the string representation of the long argument. More... | |
static OUString | valueOf (float f) |
Returns the string representation of the float argument. More... | |
static OUString | valueOf (double d) |
Returns the string representation of the double argument. More... | |
static OUString | createFromAscii (const char *value) |
Returns an OUString copied without conversion from an ASCII character string. More... | |
Friends | |
bool | operator== (const OUString &rStr1, const OUString &rStr2) |
bool | operator!= (const OUString &rStr1, const OUString &rStr2) |
bool | operator< (const OUString &rStr1, const OUString &rStr2) |
bool | operator> (const OUString &rStr1, const OUString &rStr2) |
bool | operator<= (const OUString &rStr1, const OUString &rStr2) |
bool | operator>= (const OUString &rStr1, const OUString &rStr2) |
bool | operator== (const OUString &rStr1, const sal_Unicode *pStr2) |
bool | operator== (const sal_Unicode *pStr1, const OUString &rStr2) |
bool | operator!= (const OUString &rStr1, const sal_Unicode *pStr2) |
bool | operator!= (const sal_Unicode *pStr1, const OUString &rStr2) |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | operator== (const OUString &rString, T &literal) |
Compare string to an ASCII string literal. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | operator== (T &literal, const OUString &rString) |
Compare string to an ASCII string literal. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | operator!= (const OUString &rString, T &literal) |
Compare string to an ASCII string literal. More... | |
template<typename T > | |
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type | operator!= (T &literal, const OUString &rString) |
Compare string to an ASCII string literal. More... | |
OUString | operator+ (const OUString &rStr1, const OUString &rStr2) |
This String class provides base functionality for C++ like Unicode character array handling.
The advantage of this class is that it handles all the memory management for you - and it does it more efficiently. If you assign a string to another string, the data of both strings are shared (without any copy operation or memory allocation) as long as you do not change the string. This class also stores the length of the string, so that many operations are faster than the C-str-functions.
This class provides only readonly string handling. So you could create a string and you could only query the content from this string. It provides also functionality to change the string, but this results in every case in a new string instance (in the most cases with a memory allocation). You don't have functionality to change the content of the string. If you want to change the string content, then you should use the OStringBuffer class, which provides these functionalities and avoids too much memory allocation.
The design of this class is similar to the string classes in Java so less people should have understanding problems when they use this class.
|
inline |
New string containing no characters.
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
New string from a single Unicode character.
value | a Unicode character. |
|
inline |
New string from a Unicode character buffer array.
value | a NULL-terminated Unicode character array. |
|
inline |
New string from a Unicode character buffer array.
value | a Unicode character array. |
length | the number of character which should be copied. The character array length must be greater than or equal to this value. |
|
inline |
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set (i.e.
first 128 characters). This constructor allows an efficient and convenient way to create OUString instances from ASCII literals. When creating strings from data that is not pure ASCII, it needs to be converted to OUString by explicitly providing the encoding to use for the conversion.
If there are any embedded \0's in the string literal, the result is undefined. Use the overload that explicitly accepts length.
literal | the 8-bit ASCII string literal |
|
inline |
New string from an 8-Bit character buffer array.
value | An 8-Bit character array. |
length | The number of character which should be converted. The 8-Bit character array length must be greater than or equal to this value. |
encoding | The text encoding from which the 8-Bit character sequence should be converted. |
convertFlags | Flags which control the conversion. see RTL_TEXTTOUNICODE_FLAGS_... |
std::bad_alloc | is thrown if an out-of-memory condition occurs |
|
inlineexplicit |
Create a new string from an array of Unicode code points.
codePoints | an array of at least codePointCount code points, which each must be in the range from 0 to 0x10FFFF, inclusive. May be null if codePointCount is zero. |
codePointCount | the non-negative number of code points. |
std::bad_alloc | is thrown if either an out-of-memory condition occurs or the resulting number of UTF-16 code units would have been larger than SAL_MAX_INT32. |
|
inline |
Release the string data.
|
inlinestatic |
Returns the string representation of the boolean argument.
If the argument is true, the string "true" is returned. If the argument is false, the string "false" is returned. This function can't be used for language specific conversion.
b | a bool. |
|
inline |
Clears the string, i.e, makes a zero-character string.
|
inline |
Compares two strings.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. This function can't be used for language specific sorting.
str | the object to be compared. |
|
inline |
Compares two strings with a maximum count of characters.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. This function can't be used for language specific sorting.
str | the object to be compared. |
maxLength | the maximum count of characters to be compared. |
|
inline |
Compares two strings.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated. This function can't be used for language specific sorting.
asciiStr | the 8-Bit ASCII character string to be compared. |
|
inline |
Compares two strings with a maximum count of characters.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated. This function can't be used for language specific sorting.
asciiStr | the 8-Bit ASCII character string to be compared. |
maxLength | the maximum count of characters to be compared. |
|
inline |
Perform an ASCII lowercase comparison of two strings.
Compare the two strings with uppercase ASCII character values between 65 and 90 (ASCII A-Z) interpreted as values between 97 and 122 (ASCII a-z). This function can't be used for language specific comparison.
str | the object to be compared. |
|
inline |
Compares two ASCII strings ignoring case.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated. This function can't be used for language specific sorting.
asciiStr | the 8-Bit ASCII character string to be compared. |
|
inline |
Concatenates the specified string to the end of this string.
str | the string that is concatenated to the end of this string. |
|
inline |
Converts to an OString, signalling failure.
pTarget | An out parameter receiving the converted OString. Must not be null; the contents are not modified if conversion fails (convertToOString returns false). |
nEncoding | The text encoding to convert into. Must be an octet encoding (i.e., rtl_isOctetTextEncoding(nEncoding) must return true). |
nFlags | A combination of RTL_UNICODETOTEXT_FLAGS that detail how to do the conversion (see rtl_convertUnicodeToText). RTL_UNICODETOTEXT_FLAGS_FLUSH need not be included, it is implicitly assumed. Typical uses are either RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR (fail if a Unicode character cannot be converted to the target nEncoding) or OUSTRING_TO_OSTRING_CVTFLAGS (make a best efforts conversion). |
|
inline |
Returns a new string that is a substring of this string.
The substring begins at the specified beginIndex. If beginIndex is negative or be greater than the length of this string, behaviour is undefined.
beginIndex | the beginning index, inclusive. |
|
inline |
Returns a new string that is a substring of this string.
The substring begins at the specified beginIndex and contains count characters. If either beginIndex or count are negative, or beginIndex + count are greater than the length of this string then behaviour is undefined.
beginIndex | the beginning index, inclusive. |
count | the number of characters. |
|
inlinestatic |
Returns an OUString copied without conversion from an ASCII character string.
Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated.
Note that for string literals it is simpler and more efficient to directly use the OUString constructor.
value | the 8-Bit ASCII character string |
Check whether this string ends with a given substring.
str | the substring to be compared |
rest | if non-null, and this function returns true, then assign a copy of the remainder of this string to *rest. Available since LibreOffice 4.2 |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Check whether this string ends with a given ASCII string.
asciiStr | a sequence of at least asciiStrLength ASCII characters (bytes in the range 0x00–0x7F) |
asciiStrLength | the length of asciiStr; must be non-negative |
|
inline |
Check whether this string ends with a given string, ignoring the case of ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). This function can't be used for language specific comparison.
str | the substring to be compared |
rest | if non-null, and this function returns true, then assign a copy of the remainder of this string to *rest. Available since LibreOffice 4.2 |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Check whether this string ends with a given ASCII string, ignoring the case of ASCII letters.
asciiStr | a sequence of at least asciiStrLength ASCII characters (bytes in the range 0x00–0x7F) |
asciiStrLength | the length of asciiStr; must be non-negative |
|
inline |
Perform a comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string. This function can't be used for language specific comparison.
str | the object to be compared. |
|
inline |
Perform a comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated. This function can't be used for language specific comparison.
asciiStr | the 8-Bit ASCII character string to be compared. |
|
inline |
Perform a comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be greater than or equal to asciiStrLength. This function can't be used for language specific comparison.
asciiStr | the 8-Bit ASCII character string to be compared. |
asciiStrLength | the length of the ascii string |
|
inline |
Perform an ASCII lowercase comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string, ignoring the case. Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). This function can't be used for language specific comparison.
str | the object to be compared. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Perform an ASCII lowercase comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string, ignoring the case. Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be NULL-terminated. This function can't be used for language specific comparison.
asciiStr | the 8-Bit ASCII character string to be compared. |
|
inline |
Perform an ASCII lowercase comparison of two strings.
The result is true if and only if second string represents the same sequence of characters as the first string, ignoring the case. Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be greater than or equal to asciiStrLength. This function can't be used for language specific comparison.
asciiStr | the 8-Bit ASCII character string to be compared. |
asciiStrLength | the length of the ascii string |
|
inline |
Returns the length of this string.
The length is equal to the number of Unicode characters in this string.
|
inline |
Returns a pointer to the Unicode character buffer for this string.
It isn't necessarily NULL terminated.
|
inline |
Returns a token in the string.
Example: sal_Int32 nIndex = 0; do { ... OUString aToken = aStr.getToken( 0, ';', nIndex ); ... } while ( nIndex >= 0 );
token | the number of the token to return |
cTok | the character which separate the tokens. |
index | the position at which the token is searched in the string. The index must not be greater than the length of the string. This param is set to the position of the next token or to -1, if it is the last token. |
|
inline |
Returns a token from the string.
The same as getToken(sal_Int32, sal_Unicode, sal_Int32 &), but always passing in 0 as the start index in the third argument.
count | the number of the token to return, starting with 0 |
separator | the character which separates the tokens |
|
inline |
Returns a hashcode for this string.
|
inline |
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
ch | character to be located. |
fromIndex | the index to start the search from. The index must be greater than or equal to 0 and less than or equal to the string length. |
|
inline |
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
If str doesn't include any character, always -1 is returned. This is also the case, if both strings are empty.
str | the substring to search for. |
fromIndex | the index to start the search from. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Returns the index within this string of the first occurrence of the specified ASCII substring, starting at the specified index.
str | the substring to be searched for. Need not be null-terminated, but must be at least as long as the specified len. Must only contain characters in the ASCII range 0x00–7F. |
len | the length of the substring; must be non-negative. |
fromIndex | the index to start the search from. Must be in the range from zero to the length of this string, inclusive. |
|
inline |
Return a canonical representation for a string.
A pool of strings, initially empty is maintained privately by the string class. On invocation, if present in the pool the original string will be returned. Otherwise this string, or a copy thereof will be added to the pool and returned.
std::bad_alloc | is thrown if an out-of-memory condition occurs |
|
inlinestatic |
Return a canonical representation for a converted string.
A pool of strings, initially empty is maintained privately by the string class. On invocation, if present in the pool the original string will be returned. Otherwise this string, or a copy thereof will be added to the pool and returned.
value | a 8-Bit character array. |
length | the number of character which should be converted. The 8-Bit character array length must be greater than or equal to this value. |
encoding | the text encoding from which the 8-Bit character sequence should be converted. |
convertFlags | flags which controls the conversion. see RTL_TEXTTOUNICODE_FLAGS_... |
pInfo | pointer to return conversion status or NULL. |
std::bad_alloc | is thrown if an out-of-memory condition occurs |
|
inline |
Checks if a string is empty.
|
inline |
Iterate through this string based on code points instead of UTF-16 code units.
See Chapter 3 of The Unicode Standard 5.0 (Addison–Wesley, 2006) for definitions of the various terms used in this description.
This string is interpreted as a sequence of zero or more UTF-16 code units. For each index into this sequence (from zero to one less than the length of the sequence, inclusive), a code point represented starting at the given index is computed as follows:
indexUtf16 | pointer to a UTF-16 based index into this string; must not be null. On entry, the index must be in the range from zero to the length of this string (in UTF-16 code units), inclusive. Upon successful return, the index will be updated to address the UTF-16 code unit that is the given incrementCodePoints away from the initial index. |
incrementCodePoints | the number of code points to move the given *indexUtf16. If non-negative, moving is done after determining the code point at the index. If negative, moving is done before determining the code point at the (then updated) index. The value must be such that the resulting UTF-16 based index is in the range from zero to the length of this string (in UTF-16 code units), inclusive. |
|
inline |
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
ch | character to be located. |
|
inline |
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
ch | character to be located. |
fromIndex | the index before which to start the search. |
|
inline |
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
The returned index indicates the starting index of the substring in this string. If str doesn't include any character, always -1 is returned. This is also the case, if both strings are empty.
str | the substring to search for. |
|
inline |
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
The returned index indicates the starting index of the substring in this string. If str doesn't include any character, always -1 is returned. This is also the case, if both strings are empty.
str | the substring to search for. |
fromIndex | the index before which to start the search. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Returns the index within this string of the last occurrence of the specified ASCII substring.
str | the substring to be searched for. Need not be null-terminated, but must be at least as long as the specified len. Must only contain characters in the ASCII range 0x00–7F. |
len | the length of the substring; must be non-negative. |
|
inline |
Match against a substring appearing in this string.
The result is true if and only if the second string appears as a substring of this string, at the given position. This function can't be used for language specific comparison.
str | the object (substring) to be compared. |
fromIndex | the index to start the comparison from. The index must be greater than or equal to 0 and less or equal as the string length. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Match against a substring appearing in this string.
The result is true if and only if the second string appears as a substring of this string, at the given position. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be greater than or equal to asciiStrLength. This function can't be used for language specific comparison.
asciiStr | the object (substring) to be compared. |
asciiStrLength | the length of asciiStr. |
fromIndex | the index to start the comparison from. The index must be greater than or equal to 0 and less than or equal to the string length. |
|
inline |
Match against a substring appearing in this string, ignoring the case of ASCII letters.
The result is true if and only if the second string appears as a substring of this string, at the given position. Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). This function can't be used for language specific comparison.
str | the object (substring) to be compared. |
fromIndex | the index to start the comparison from. The index must be greater than or equal to 0 and less than or equal to the string length. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Match against a substring appearing in this string, ignoring the case of ASCII letters.
The result is true if and only if the second string appears as a substring of this string, at the given position. Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be greater than or equal to asciiStrLength. This function can't be used for language specific comparison.
asciiStr | the 8-Bit ASCII character string to be compared. |
asciiStrLength | the length of the ascii string |
fromIndex | the index to start the comparison from. The index must be greater than or equal to 0 and less than or equal to the string length. |
|
inlinestatic |
Returns the string representation of the integer argument.
This function can't be used for language specific conversion.
i | an integer value |
radix | the radix (between 2 and 36) |
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
Returns the string representation of the float argument.
This function can't be used for language specific conversion.
f | a float. |
|
inlinestatic |
Returns the string representation of the double argument.
This function can't be used for language specific conversion.
d | a double. |
Append a string to this string.
str | an OUString. |
std::bad_alloc | is thrown if an out-of-memory condition occurs |
|
inline |
Append an ASCII string literal to this string.
literal | an 8-bit ASCII-only string literal |
Assign a new string.
str | an OUString. |
|
inline |
Assign a new string from an 8-Bit string literal that is expected to contain only characters in the ASCII set (i.e.
first 128 characters). This operator allows an efficient and convenient way to assign OUString instances from ASCII literals. When assigning strings from data that is not pure ASCII, it needs to be converted to OUString by explicitly providing the encoding to use for the conversion.
literal | the 8-bit ASCII string literal |
|
inline |
Access to individual characters.
index | must be non-negative and less than length. |
|
inline |
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
If the character oldChar does not occur in the character sequence represented by this object, then the string is assigned with str.
oldChar | the old character. |
newChar | the new character. |
|
inline |
Returns a new string resulting from replacing all occurrences of a given substring with another substring.
Replacing subsequent occurrences picks up only after a given replacement. That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
from | the substring to be replaced |
to | the replacing substring |
fromIndex | the position in the string where we will begin searching |
|
inline |
Returns a new string resulting from replacing all occurrences of a given substring with another substring.
Replacing subsequent occurrences picks up only after a given replacement. That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
from | ASCII string literal, the substring to be replaced |
to | the replacing substring |
|
inline |
Returns a new string resulting from replacing all occurrences of a given substring with another substring.
Replacing subsequent occurrences picks up only after a given replacement. That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
from | the substring to be replaced |
to | ASCII string literal, the replacing substring |
|
inline |
Returns a new string resulting from replacing all occurrences of a given substring with another substring.
Replacing subsequent occurrences picks up only after a given replacement. That is, replacing from "xa" to "xx" in "xaa" results in "xxa", not "xxx".
from | ASCII string literal, the substring to be replaced |
to | ASCII string literal, the substring to be replaced |
|
inline |
Returns a new string resulting from replacing n = count characters from position index in this string with newStr.
index | the replacing index in str. The index must be greater than or equal to 0 and less than or equal to the length of the string. |
count | the count of characters that will be replaced The count must be greater than or equal to 0 and less than or equal to the length of the string minus index. |
newStr | the new substring. |
|
inline |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring.
from | the substring to be replaced | |
to | the replacing substring | |
[in,out] | index | pointer to a start index; if the pointer is non-null: upon entry to the function, its value is the index into this string at which to start searching for the from substring, the value must be non-negative and not greater than this string's length; upon exiting the function its value is the index into this string at which the replacement took place or -1 if no replacement took place; if the pointer is null, searching always starts at index 0 |
|
inline |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring.
from | ASCII string literal, the substring to be replaced | |
to | the replacing substring | |
[in,out] | index | pointer to a start index; if the pointer is non-null: upon entry to the function, its value is the index into the this string at which to start searching for the from substring, the value must be non-negative and not greater than this string's length; upon exiting the function its value is the index into this string at which the replacement took place or -1 if no replacement took place; if the pointer is null, searching always starts at index 0 |
|
inline |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring.
from | the substring to be replaced | |
to | ASCII string literal, the replacing substring | |
[in,out] | index | pointer to a start index; if the pointer is non-null: upon entry to the function, its value is the index into the this string at which to start searching for the from substring, the value must be non-negative and not greater than this string's length; upon exiting the function its value is the index into this string at which the replacement took place or -1 if no replacement took place; if the pointer is null, searching always starts at index 0 |
|
inline |
Returns a new string resulting from replacing the first occurrence of a given substring with another substring.
from | ASCII string literal, the substring to be replaced | |
to | ASCII string literal, the substring to be replaced | |
[in,out] | index | pointer to a start index; if the pointer is non-null: upon entry to the function, its value is the index into the this string at which to start searching for the from substring, the value must be non-negative and not greater than this string's length; upon exiting the function its value is the index into this string at which the replacement took place or -1 if no replacement took place; if the pointer is null, searching always starts at index 0 |
|
inline |
Compares two strings in reverse order.
The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. This function can't be used for language specific sorting.
str | the object to be compared. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Compares two strings in reverse order.
This could be useful, if normally both strings start with the same content. The comparison is based on the numeric value of each character in the strings and return a value indicating their relationship. Since this method is optimized for performance, the ASCII character values are not converted in any way. The caller has to make sure that all ASCII characters are in the allowed range between 0 and 127. The ASCII string must be greater than or equal to asciiStrLength. This function can't be used for language specific sorting.
asciiStr | the 8-Bit ASCII character string to be compared. |
asciiStrLength | the length of the ascii string |
Check whether this string starts with a given substring.
str | the substring to be compared |
rest | if non-null, and this function returns true, then assign a copy of the remainder of this string to *rest. Available since LibreOffice 4.2 |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Character values between 65 and 90 (ASCII A-Z) are interpreted as values between 97 and 122 (ASCII a-z). This function can't be used for language specific comparison.
str | the substring to be compared |
rest | if non-null, and this function returns true, then assign a copy of the remainder of this string to *rest. Available since LibreOffice 4.2 |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function accepts an ASCII string literal as its argument.
|
inline |
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-122).
This function can't be used for language specific conversion. If the string doesn't contain characters which must be converted, then the new string is assigned with str.
|
inline |
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-90).
This function can't be used for language specific conversion. If the string doesn't contain characters which must be converted, then the new string is assigned with str.
|
inline |
Returns the Boolean value from this string.
This function can't be used for language specific conversion.
|
inline |
Returns the first character from this string.
|
inline |
Returns the double value from this string.
This function can't be used for language specific conversion.
|
inline |
Returns the float value from this string.
This function can't be used for language specific conversion.
|
inline |
Returns the int32 value from this string.
This function can't be used for language specific conversion.
radix | the radix (between 2 and 36) |
|
inline |
Returns the int64 value from this string.
This function can't be used for language specific conversion.
radix | the radix (between 2 and 36) |
|
inline |
Returns the uint32 value from this string.
This function can't be used for language specific conversion.
radix | the radix (between 2 and 36) |
|
inline |
Returns the uint64 value from this string.
This function can't be used for language specific conversion.
radix | the radix (between 2 and 36) |
|
inline |
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully.
In other words, you must not use this method on a random sequence of UTF-16 code units, but only at places where it is assumed that the content is a proper string.
|
inline |
Returns a new string resulting from removing white space from both ends of the string.
All characters that have codes less than or equal to 32 (the space character), and Unicode General Punctuation area Space and some Control characters are considered to be white space (see implIsWhitespace). If the string doesn't contain white spaces at both ends, then the new string is assigned with str.
|
inlinestatic |
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
It is more convenient to use C++ OUString member functions when dealing with rtl_uString * handles. Using this function avoids unnecessary acquire()/release() calls for a temporary OUString object.
ppHandle | pointer to storage |
Returns the string representation of the sal_Bool argument.
If the sal_Bool is true, the string "true" is returned. If the sal_Bool is false, the string "false" is returned. This function can't be used for language specific conversion.
b | a sal_Bool. |
|
inlinestatic |
Returns the string representation of the char argument.
c | a character. |
|
inlinestatic |
Returns the string representation of the int argument.
This function can't be used for language specific conversion.
i | a int32. |
radix | the radix (between 2 and 36) |
|
inlinestatic |
Returns the string representation of the long argument.
This function can't be used for language specific conversion.
ll | a int64. |
radix | the radix (between 2 and 36) |
|
inlinestatic |
Returns the string representation of the float argument.
This function can't be used for language specific conversion.
f | a float. |
|
inlinestatic |
Returns the string representation of the double argument.
This function can't be used for language specific conversion.
d | a double. |
|
friend |
|
friend |
|
friend |
Compare string to an ASCII string literal.
This operator is equal to calling !equalsAsciiL().
|
friend |
Compare string to an ASCII string literal.
This operator is equal to calling !equalsAsciiL().
|
friend |
|
friend |
|
friend |
Compare string to an ASCII string literal.
This operator is equal to calling equalsAsciiL().
|
friend |
Compare string to an ASCII string literal.
This operator is equal to calling equalsAsciiL().