Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15
 Overview   Namespace   Class   Index   Help 

Methods of Class OString


OString
OString() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string containing no characters.

OString
OString(
const OString & str ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string from OString.
Parameters
str
a OString.
    

OString
OString(
rtl_String * str ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string from OString data.
Parameters
str
a OString data.
    

OString
OString(
const sal_Char * value ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string from a character buffer array.
Parameters
value
a NULL-terminated character array.
    

OString
OString(
const sal_Char * value,
sal_Int32 length ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string from a character buffer array.
Parameters
value
a character array.
      
length
the number of character which should be copied.
                            The character array length must be greater or
                            equal than this value.
    

OString
OString(
const sal_Unicode * value,
sal_Int32 length,
rtl_TextEncoding encoding,
sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
New string from a Unicode character buffer array.
Parameters
value
a Unicode character array.
      
length
the number of character which should be converted.
                                The Unicode character array length must be
                                greater or equal than this value.
      
encoding
the text encoding in which the Unicode character
                                sequence should be converted.
      
convertFlags
flags which controls the conversion.
                                see RTL_UNICODETOTEXT_FLAGS_...
    

OString
OString(
const ByteString & value ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO NO

Summary
Convert a ByteString (from the tools module) into an OString.
Description
Since both ByteString and OString internally use the same data structure, this is a very cheap operation.

~OString
~OString() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Release the string data.

operator=
OString & operator=(
const OString & str ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Assign a new string.
Parameters
str
a OString.
    

operator+=
OString & operator+=(
const OString & str ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Append a string to this string.
Parameters
str
a OString.
    

getLength
sal_Int32 getLength() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns the length of this string.
Description
The length is equal to the number of characters in this string.
Return
the length of the sequence of characters represented by this object.

operator const sal_Char *
operator const sal_Char *() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns a pointer to the character buffer from this string.
Description
It isn't necessarily NULL terminated.
Return
a pointer to the characters buffer from this object.

getStr
const sal_Char * getStr() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns a pointer to the character buffer from this string.
Description
It isn't necessarily NULL terminated.
Return
a pointer to the characters buffer from this object.

compareTo
sal_Int32 compareTo(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Compares two strings.
Description
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.
Parameters
str
the object to be compared.
      
Return
0 - if both strings are equal < 0 - if this string is less than the string argument > 0 - if this string is greater than the string argument

compareTo
sal_Int32 compareTo(
const OString & rObj,
sal_Int32 maxLength ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Compares two strings with an maximum count of characters.
Description
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.
Parameters
str
the object to be compared.
      
maxLength
the maximum count of characters to be compared.
      
Return
0 - if both strings are equal < 0 - if this string is less than the string argument > 0 - if this string is greater than the string argument

reverseCompareTo
sal_Int32 reverseCompareTo(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Compares two strings in reverse order.
Description
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.
Parameters
str
the object to be compared.
      
Return
0 - if both strings are equal < 0 - if this string is less than the string argument > 0 - if this string is greater than the string argument

equals
sal_Bool equals(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Perform a comparison of two strings.
Description
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.
Parameters
str
the object to be compared.
      
Return
sal_True if the strings are equal; sal_False, otherwise.

equalsIgnoreAsciiCase
sal_Bool equalsIgnoreAsciiCase(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Perform a ASCII lowercase comparison of two strings.
Description
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.
Parameters
str
the object to be compared.
      
Return
sal_True if the strings are equal; sal_False, otherwise.

match
sal_Bool match(
const OString & str,
sal_Int32 fromIndex = 0 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Perform a comparison of a substring in this string.
Description
The result is true if and only if second string represents the same sequence of characters in the first string at the given position. This function can't be used for language specific comparison.
Parameters
str
the object (substring) to be compared.
      
fromIndex
the index to start the comparion from.
                            The index must be greater or equal than 0
                            and less or equal as the string length.
      
Return
sal_True if str match with the characters in the string at the given position; sal_False, otherwise.

matchIgnoreAsciiCase
sal_Bool matchIgnoreAsciiCase(
const OString & str,
sal_Int32 fromIndex = 0 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Perform a ASCII lowercase comparison of a substring in this string.
Description
The result is true if and only if second string represents the same sequence of characters in the first 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.
Parameters
str
the object (substring) to be compared.
      
fromIndex
the index to start the comparion from.
                            The index must be greater or equal than 0
                            and less or equal as the string length.
      
Return
sal_True if str match with the characters in the string at the given position; sal_False, otherwise.

hashCode
sal_Int32 hashCode() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns a hashcode for this string.
Return
a hash code value for this object.

indexOf
sal_Int32 indexOf(
sal_Char ch,
sal_Int32 fromIndex = 0 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Parameters
ch
character to be located.
fromIndex
the index to start the search from.
                      The index must be greater or equal than 0
                      and less or equal as the string length.
Return
the index of the first occurrence of the character in the character sequence represented by this string that is greater than or equal to fromIndex, or -1 if the character does not occur.

lastIndexOf
sal_Int32 lastIndexOf(
sal_Char ch ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Parameters
ch
character to be located.
Return
the index of the last occurrence of the character in the character sequence represented by this string, or -1 if the character does not occur.

lastIndexOf
sal_Int32 lastIndexOf(
sal_Char ch,
sal_Int32 fromIndex ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
Parameters
ch
character to be located.
Return
the index of the last occurrence of the character in the character sequence represented by this string that is less or than or equal to fromIndex, or -1 if the character does not occur before that point.

indexOf
sal_Int32 indexOf(
const OString & str,
sal_Int32 fromIndex = 0 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Description
If str doesn't include any character, always -1 is returned. This is also the case, if both strings are empty.
Parameters
str
the substring to search for.
fromIndex
the index to start the search from.
Return
If the string argument occurs one or more times as a substring within this string at the starting index, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.

lastIndexOf
sal_Int32 lastIndexOf(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Description
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.
Parameters
str
the substring to search for.
Return
If the string argument occurs one or more times as a substring within this string, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.

lastIndexOf
sal_Int32 lastIndexOf(
const OString & str,
sal_Int32 fromIndex ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Description
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.
Parameters
str
the substring to search for.
fromIndex
the index to start the search from.
Return
If the string argument occurs one or more times as a substring within this string at the starting index, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.

copy
OString copy(
sal_Int32 beginIndex ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns a new string that is a substring of this string. The substring begins at the specified beginIndex.
Parameters
beginIndex
the beginning index, inclusive.
Return
the specified substring.

copy
OString copy(
sal_Int32 beginIndex,
sal_Int32 count ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns a new string that is a substring of this string.
Description
The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.
Parameters
beginIndex
the beginning index, inclusive.
      
count
the number of characters.
      
Return
the specified substring.

concat
OString concat(
const OString & str ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Concatenates the specified string to the end of this string.
Parameters
str
the string that is concatenated to the end
                      of this string.
      
Return
a string that represents the concatenation of this string followed by the string argument.

replaceAt
OString replaceAt(
sal_Int32 index,
sal_Int32 count,
const OString & newStr ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns a new string resulting from replacing n = count characters from position index in this string with newStr.
Parameters
index
the replacing index in str.
                The index must be greater or equal as 0 and
                less or equal as the length of the string.
count
the count of charcters that will replaced
                The count must be greater or equal as 0 and
                less or equal as the length of the string minus index.
newStr
the new substring.
Return
the new string.

replace
OString replace(
sal_Char oldChar,
sal_Char newChar ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
Description
If the character oldChar does not occur in the character sequence represented by this object, then the string is assigned with str.
Parameters
oldChar
the old character.
newChar
the new character.
Return
a string derived from this string by replacing every occurrence of oldChar with newChar.

toAsciiLowerCase
OString toAsciiLowerCase() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-122).
Description
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.
Return
the string, converted to ASCII lowercase.

toAsciiUpperCase
OString toAsciiUpperCase() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-90).
Description
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.
Return
the string, converted to ASCII uppercase.

trim
OString trim() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns a new string resulting from removing white space from both ends of the string.
Description
All characters that have codes less than or equal to 32 (the space character) are considered to be white space. If the string doesn't contain white spaces at both ends, then the new string is assigned with str.
Return
the string, with white space removed from the front and end.

getToken
OString getToken(
sal_Int32 token,
sal_Char cTok,
sal_Int32 & index ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns a token in the string.
Description
Example: sal_Int32 nIndex = 0; do { ... OString aToken = aStr.getToken( 0, ';', nIndex ); ... } while ( nIndex >= 0 );
Parameters
token
the number of the token to return. The number
                            must be greater or equal as 0.
      
cTok
the character which seperate the tokens.
      
index
the position at which the token is searched in the
                            string.
                            The index must be greater or equal as 0 and
                            less or equal as 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.
      
Return
the token

toBoolean
sal_Bool toBoolean() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns the Boolean value from this string.
Description
This function can't be used for language specific conversion.
Return
sal_True, if the string is 1 or "True" in any ASCII case. sal_False in any other case.

toChar
sal_Char toChar() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns the first character from this string.
Return
the first character from this string or 0, if this string is emptry.

toInt32
sal_Int32 toInt32(
sal_Int16 radix = 10 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the int32 value from this string.
Description
This function can't be used for language specific conversion.
Parameters
radix
the radix (between 2 and 36)
      
Return
the int32 represented from this string. 0 if this string represents no number.

toInt64
sal_Int64 toInt64(
sal_Int16 radix = 10 ) const throw();

virtual abstract const volatile template static inline C-linkage
NO NO YES NO NO NO YES NO

Summary
Returns the int64 value from this string.
Description
This function can't be used for language specific conversion.
Parameters
radix
the radix (between 2 and 36)
      
Return
the int64 represented from this string. 0 if this string represents no number.

toFloat
float toFloat() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns the float value from this string.
Description
This function can't be used for language specific conversion.
Return
the float represented from this string. 0.0 if this string represents no number.

toDouble
double toDouble() throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Returns the double value from this string.
Description
This function can't be used for language specific conversion.
Return
the double represented from this string. 0.0 if this string represents no number.

valueOf
static OString valueOf(
sal_Bool b ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the sal_Bool argument.
Description
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.
Parameters
b
a sal_Bool.
      
Return
a string with the string representation of the argument.

valueOf
static OString valueOf(
sal_Char c ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the char argument.
Parameters
c
a character.
      
Return
a string with the string representation of the argument.

valueOf
static OString valueOf(
sal_Int32 i,
sal_Int16 radix = 10 ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the int argument.
Description
This function can't be used for language specific conversion.
Parameters
i
a int32.
      
radix
the radix (between 2 and 36)
      
Return
a string with the string representation of the argument.

valueOf
static OString valueOf(
sal_Int64 l,
sal_Int16 radix = 10 ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the long argument.
Description
This function can't be used for language specific conversion.
Parameters
l
a int64.
      
radix
the radix (between 2 and 36)
      
Return
a string with the string representation of the argument.

valueOf
static OString valueOf(
float f ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the float argument.
Description
This function can't be used for language specific conversion.
Parameters
f
a float.
      
Return
a string with the string representation of the argument.

valueOf
static OString valueOf(
double d ) throw();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Returns the string representation of the double argument.
Description
This function can't be used for language specific conversion.
Parameters
d
a double.
      
Return
a string with the string representation of the argument.

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.