activemq-cpp-3.9.0
|
An immutable sequence of characters. More...
#include <src/main/decaf/lang/String.h>
Public Member Functions | |||||||
String () | |||||||
Creates a new empty String object. More... | |||||||
String (const char value, int count) | |||||||
Create a new String instance that contains N copies of the given character value. More... | |||||||
String (const String &source) | |||||||
Create a new String object that represents the given STL string. More... | |||||||
String (const std::string &source) | |||||||
Create a new String object that represents the given STL string. More... | |||||||
String (const char *array) | |||||||
Create a new String object that represents the given array of characters, the C string must be null terminated in order for a proper size calculation to work. More... | |||||||
String (const char *array, int size) | |||||||
Create a new String object that represents the given array of characters. More... | |||||||
String (const char *array, int offset, int length) | |||||||
Create a new String object that represents the given array of characters, the C string must be null terminated in order for a proper size calculation to work. More... | |||||||
String (const char *array, int size, int offset, int length) | |||||||
Create a new String object that represents the given array of characters. More... | |||||||
virtual | ~String () | ||||||
String & | operator= (const String &other) | ||||||
Assignment from another String instance. More... | |||||||
String & | operator= (const std::string &other) | ||||||
Assignment from another std::string instance. More... | |||||||
String & | operator= (const char *other) | ||||||
Assignment from another C string instance. More... | |||||||
bool | operator== (const char *other) const | ||||||
Comparison operators for the various string types that uses the equals method to determine equality. More... | |||||||
bool | operator== (const String &other) const | ||||||
bool | operator== (const std::string &other) const | ||||||
bool | operator!= (const char *other) const | ||||||
Comparison operators for the various string types that uses the equals method to determine equality. More... | |||||||
bool | operator!= (const String &other) const | ||||||
bool | operator!= (const std::string &other) const | ||||||
bool | operator< (const char *other) const | ||||||
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically less than the other. More... | |||||||
bool | operator< (const String &other) const | ||||||
bool | operator< (const std::string &other) const | ||||||
bool | operator<= (const char *other) const | ||||||
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically less than or equal to the other. More... | |||||||
bool | operator<= (const String &other) const | ||||||
bool | operator<= (const std::string &other) const | ||||||
bool | operator> (const char *other) const | ||||||
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically greater than the other. More... | |||||||
bool | operator> (const String &other) const | ||||||
bool | operator> (const std::string &other) const | ||||||
bool | operator>= (const char *other) const | ||||||
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically greater than or equal to the other. More... | |||||||
bool | operator>= (const String &other) const | ||||||
bool | operator>= (const std::string &other) const | ||||||
String | operator+ (const String &other) const | ||||||
Concatenation operators for the various string types. More... | |||||||
String | operator+ (const std::string &other) const | ||||||
String | operator+ (const char *other) const | ||||||
const char * | c_str () const | ||||||
Returns a const char* value to allow easier coexistence with standard c++ string operations. More... | |||||||
String | compact () const | ||||||
If the String instance is holding a reference to a character array that is larger than the string's view of the backing store a new array is allocated and the characters from the substring this String represents are copied to the new backing store and returned in the resulting String object. More... | |||||||
int | compareTo (const String &string) const | ||||||
Compares two strings lexicographically. More... | |||||||
int | compareTo (const std::string &string) const | ||||||
Compares two strings lexicographically. More... | |||||||
int | compareTo (const char *string) const | ||||||
Compares two strings lexicographically. More... | |||||||
int | compareToIgnoreCase (const String &string) const | ||||||
Compares two strings lexicographically, ignoring case differences. More... | |||||||
int | compareToIgnoreCase (const std::string &string) const | ||||||
Compares two strings lexicographically, ignoring case differences. More... | |||||||
int | compareToIgnoreCase (const char *string) const | ||||||
Compares two strings lexicographically, ignoring case differences. More... | |||||||
String | concat (const String &string) const | ||||||
Concatenates this string and the specified string. More... | |||||||
String | concat (const std::string &string) const | ||||||
Concatenates this string and the specified std::string. More... | |||||||
String | concat (const char *string) const | ||||||
Concatenates this string and the specified C string. More... | |||||||
bool | contains (const String &string) const | ||||||
Determines if this String contains the sequence of characters in the String passed in. More... | |||||||
bool | contains (const std::string &string) const | ||||||
Determines if this String contains the sequence of characters in the std::string passed in. More... | |||||||
bool | contains (const char *string) const | ||||||
Determines if this String contains the sequence of characters in the C String passed in. More... | |||||||
bool | endsWith (const String &suffix) const | ||||||
Compares the specified string to this string to determine if the specified string is a suffix. More... | |||||||
bool | equals (const String &other) const | ||||||
Returns true if this String is equal to the given String instance. More... | |||||||
bool | equals (const std::string &other) const | ||||||
Returns true if this String is equal to the given std::string instance. More... | |||||||
bool | equals (const char *other) const | ||||||
Returns true if this String is equal to the given C string instance. More... | |||||||
bool | equalsIgnoreCase (const String &string) const | ||||||
Compares the specified string to this string ignoring the case of the characters and returns true if they are equal. More... | |||||||
bool | equalsIgnoreCase (const std::string &string) const | ||||||
Compares the specified std::string to this String ignoring the case of the characters and returns true if they are equal. More... | |||||||
bool | equalsIgnoreCase (const char *string) const | ||||||
Compares the specified C string to this string ignoring the case of the characters and returns true if they are equal. More... | |||||||
int | findFirstOf (const String &chars) const | ||||||
Searches in this string for the first index of any character in the specified String. More... | |||||||
int | findFirstOf (const String &chars, int start) const | ||||||
Searches in this string for the first index of any character in the specified String. More... | |||||||
int | findFirstNotOf (const String &chars) const | ||||||
Searches in this string for the first index of any character that is not in the specified String. More... | |||||||
int | findFirstNotOf (const String &chars, int start) const | ||||||
Searches in this string for the first index of any character that is not in the specified String. More... | |||||||
void | getChars (int srcBegin, int srcEnd, char *dest, int destSize, int destBegin) const | ||||||
Copies characters from this String into the destination char array, starting from the given index. More... | |||||||
int | hashCode () const | ||||||
Returns a hash code for this String instance, the hash code for an empty String will always be zero. More... | |||||||
int | indexOf (char value) const | ||||||
Searches in this string for the first index of the specified character. More... | |||||||
int | indexOf (char value, int start) const | ||||||
Searches in this string for the index of the specified character. More... | |||||||
int | indexOf (const String &string) const | ||||||
Searches in this string for the first index of the specified string. More... | |||||||
int | indexOf (const String &subString, int start) const | ||||||
Searches in this string for the index of the specified string. More... | |||||||
int | indexOf (const std::string &string) const | ||||||
Searches in this String for the first index of the specified std::string. More... | |||||||
int | indexOf (const std::string &subString, int start) const | ||||||
Searches in this string for the index of the specified std::string. More... | |||||||
int | indexOf (const char *string) const | ||||||
Searches in this String for the first index of the specified C string. More... | |||||||
int | indexOf (const char *subString, int start) const | ||||||
Searches in this string for the index of the specified C string. More... | |||||||
bool | isEmpty () const | ||||||
int | lastIndexOf (char value) const | ||||||
Searches in this string for the last index of the specified character. More... | |||||||
int | lastIndexOf (char value, int start) const | ||||||
Searches in this string for the index of the specified character. More... | |||||||
int | lastIndexOf (const String &string) const | ||||||
Searches in this string for the last index of the specified string. More... | |||||||
int | lastIndexOf (const String &subString, int start) const | ||||||
Searches in this string for the index of the specified string. More... | |||||||
int | lastIndexOf (const std::string &string) const | ||||||
Searches in this string for the last index of the specified std::string. More... | |||||||
int | lastIndexOf (const std::string &subString, int start) const | ||||||
Searches in this string for the index of the specified std::string. More... | |||||||
int | lastIndexOf (const char *string) const | ||||||
Searches in this string for the last index of the specified C string. More... | |||||||
int | lastIndexOf (const char *subString, int start) const | ||||||
Searches in this string for the index of the specified C string. More... | |||||||
bool | regionMatches (int thisStart, const String &string, int start, int length) const | ||||||
Compares the specified string to this string and compares the specified range of characters to determine if they are the same. More... | |||||||
bool | regionMatches (bool ignoreCase, int thisStart, const String &string, int start, int length) const | ||||||
Compares the specified string to this string and compares the specified range of characters to determine if they are the same. More... | |||||||
String | replace (char oldChar, char newChar) const | ||||||
Copies this string replacing occurrences of the specified character with another character. More... | |||||||
bool | startsWith (const String &prefix) const | ||||||
Compares the specified string to this string to determine if the specified string is a prefix. More... | |||||||
bool | startsWith (const String &prefix, int start) const | ||||||
Compares the specified string to this string, starting at the specified offset, to determine if the specified string is a prefix. More... | |||||||
String | substring (int start) const | ||||||
Copies a range of characters into a new string starting from the given offset and extending to the end of this String. More... | |||||||
String | substring (int start, int end) const | ||||||
Copies a range of characters into a new string. More... | |||||||
char * | toCharArray () const | ||||||
Copies the characters in this string to a newly allocated character array. More... | |||||||
String | toLowerCase () const | ||||||
Converts the characters in this string to lower case. More... | |||||||
String | toUpperCase () const | ||||||
Converts the characters in this string to upper case. More... | |||||||
String | trim () const | ||||||
Returns a copy of the string, with leading and trailing whitespace omitted. More... | |||||||
virtual int | length () const | ||||||
| |||||||
virtual char | charAt (int index) const | ||||||
Returns the Char at the specified index so long as the index is not greater than the length of the sequence.
| |||||||
virtual CharSequence * | subSequence (int start, int end) const | ||||||
Returns a new CharSequence that is a subsequence of this sequence.The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.
| |||||||
virtual std::string | toString () const | ||||||
| |||||||
![]() | |||||||
virtual | ~CharSequence () | ||||||
Static Public Member Functions | |
static String | copyValueOf (const char *data) |
Creates a new string containing the characters in the specified character array. More... | |
static String | copyValueOf (char *data, int start, int length) |
Creates a new string containing the specified characters in the character array. More... | |
static bool | isNullOrEmpty (const char *) |
Given a C String pointer return true if the value is either NULL or the string contained is empty. More... | |
static String | valueOf (bool value) |
Returns a String that represents the value of the given boolean value. More... | |
static String | valueOf (char value) |
Returns a String that represents the value of the given char value. More... | |
static String | valueOf (float value) |
Returns a String that represents the value of the given float value. More... | |
static String | valueOf (double value) |
Returns a String that represents the value of the given double value. More... | |
static String | valueOf (short value) |
Returns a String that represents the value of the given short value. More... | |
static String | valueOf (int value) |
Returns a String that represents the value of the given integer value. More... | |
static String | valueOf (long long value) |
Returns a String that represents the value of the given 64bit long value. More... | |
Friends | |
class | AbstractStringBuilder |
An immutable sequence of characters.
This class is implemented using a char[]. The length of the array may exceed the length of the string. For example, the string "Hello" may be backed by the array
with offset 0 and length 5.
Multiple strings can share the same char[] because strings are immutable.
The substring method always returns a string that shares the backing array of its source string. Generally this is an optimization: fewer character arrays need to be allocated, and less copying is necessary. But this can also lead to unwanted heap retention. Taking a short substring of long string means that the long shared char[] won't be garbage until both strings are destroyed. This typically happens when parsing small substrings out of a large input. To avoid this where necessary, call the compact method which allocates a new array that is just big enough to store the String's content.
decaf::lang::String::String | ( | ) |
decaf::lang::String::String | ( | const char | value, |
int | count | ||
) |
decaf::lang::String::String | ( | const std::string & | source | ) |
decaf::lang::String::String | ( | const char * | array | ) |
Create a new String object that represents the given array of characters, the C string must be null terminated in order for a proper size calculation to work.
If the string is not properly terminated than this method can overrun the array and cause a fault.
array | The character buffer to copy into this new String object. |
NullPointerException | if the character array parameter is NULL. |
decaf::lang::String::String | ( | const char * | array, |
int | size | ||
) |
Create a new String object that represents the given array of characters.
The method takes the size of the array as a parameter to allow for strings that are not NULL terminated, the caller can pass strlen(array) in the case where the array is properly NULL terminated.
array | The character buffer to copy into this new String object. |
size | The size of the string buffer given, in case the string is not NULL terminated. |
NullPointerException | if the character array parameter is NULL. |
IndexOutOfBoundsException | if the size parameter is negative. |
decaf::lang::String::String | ( | const char * | array, |
int | offset, | ||
int | length | ||
) |
Create a new String object that represents the given array of characters, the C string must be null terminated in order for a proper size calculation to work.
If the string is not properly terminated than this method can overrun the array and cause a fault.
array | The character buffer to copy into this new String object. |
offset | The position to start copying from in the given buffer. |
length | The number of bytes to copy from the given buffer starting from the offset. |
NullPointerException | if the character array parameter is NULL. |
IndexOutOfBoundsException | if the size, offset or length parameter is negative or if the length to copy is greater than the span of size - offset. |
decaf::lang::String::String | ( | const char * | array, |
int | size, | ||
int | offset, | ||
int | length | ||
) |
Create a new String object that represents the given array of characters.
The method takes the size of the array as a parameter to allow for strings that are not NULL terminated, the caller can pass strlen(array) in the case where the array is properly NULL terminated.
array | The character buffer to copy into this new String object. |
size | The size of the string buffer given, in case the string is not NULL terminated. |
offset | The position to start copying from in the given buffer. |
length | The number of bytes to copy from the given buffer starting from the offset. |
NullPointerException | if the character array parameter is NULL. |
IndexOutOfBoundsException | if the size, offset or length parameter is negative or if the length to copy is greater than the span of size - offset. |
|
virtual |
const char* decaf::lang::String::c_str | ( | ) | const |
Returns a const char* value to allow easier coexistence with standard c++ string operations.
This method can result in a compaction of the String's backing store into a new character array in order to return a pointer value that is guaranteed to be NULL terminated.
|
virtual |
Returns the Char at the specified index so long as the index is not greater than the length of the sequence.
index | The position to return the char at. |
IndexOutOfBoundsException | if index is > than length() or negative |
Implements decaf::lang::CharSequence.
String decaf::lang::String::compact | ( | ) | const |
If the String instance is holding a reference to a character array that is larger than the string's view of the backing store a new array is allocated and the characters from the substring this String represents are copied to the new backing store and returned in the resulting String object.
This can free up heap memory when a String is holding a large array but only viewing a small portion of it and the original source String is no longer also maintaining a reference to the backing store.
Compares two strings lexicographically.
The comparison is based on the value of each character in the strings. The character sequence represented by this String is compared lexicographically to the character sequence represented by the provided string. The result is a negative number if this String lexicographically precedes the argument string. The result is a positive value if this String lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals method would return true.
string | the string to compare. |
int decaf::lang::String::compareTo | ( | const std::string & | string | ) | const |
Compares two strings lexicographically.
The comparison is based on the value of each character in the strings. The character sequence represented by this String is compared lexicographically to the character sequence represented by the provided string. The result is a negative number if this String lexicographically precedes the argument string. The result is a positive value if this String lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals method would return true.
string | the STL string to compare. |
int decaf::lang::String::compareTo | ( | const char * | string | ) | const |
Compares two strings lexicographically.
The comparison is based on the value of each character in the strings. The character sequence represented by this String is compared lexicographically to the character sequence represented by the provided string. The result is a negative number if this String lexicographically precedes the argument string. The result is a positive value if this String lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals method would return true.
string | the C string to compare. |
NullPointerException | if the passed in C String value is NULL. |
Compares two strings lexicographically, ignoring case differences.
This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character::toLowerCase() on each character.
string | the string to compare. |
int decaf::lang::String::compareToIgnoreCase | ( | const std::string & | string | ) | const |
Compares two strings lexicographically, ignoring case differences.
This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character::toLowerCase() on each character.
string | the STL string to compare. |
int decaf::lang::String::compareToIgnoreCase | ( | const char * | string | ) | const |
Compares two strings lexicographically, ignoring case differences.
This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character::toLowerCase() on each character.
string | the C string to compare. |
NullPointerException | if the passed in C String value is NULL. |
Concatenates this string and the specified string.
string | the string to concatenate onto this String |
Concatenates this string and the specified std::string.
string | the STL string to concatenate onto this String |
Concatenates this string and the specified C string.
string | the C string to concatenate onto this String |
bool decaf::lang::String::contains | ( | const std::string & | string | ) | const |
bool decaf::lang::String::contains | ( | const char * | string | ) | const |
Creates a new string containing the characters in the specified character array.
Modifying the character array after creating the string has no effect on the string.
data | the array of characters. |
NullPointerException | if the C string pointer is NULL |
|
static |
Creates a new string containing the specified characters in the character array.
Modifying the character array after creating the string has no effect on the string.
data | the array of characters. |
start | the starting offset in the character array. |
length | the number of characters to use. |
NullPointerException | if the C string is NULL |
IndexOutOfBoundsException | if length < 0, start < 0 or start + length > the C string's length. |
Compares the specified string to this string to determine if the specified string is a suffix.
suffix | the suffix to look for. |
bool decaf::lang::String::equals | ( | const std::string & | other | ) | const |
bool decaf::lang::String::equals | ( | const char * | other | ) | const |
Returns true if this String is equal to the given C string instance.
This method treats the NULL pointer case as equivalent to the empty string case and returns true if this String instance is also empty.
other | A C string instance to compare to this String. |
Compares the specified string to this string ignoring the case of the characters and returns true if they are equal.
string | the string to compare. |
bool decaf::lang::String::equalsIgnoreCase | ( | const std::string & | string | ) | const |
bool decaf::lang::String::equalsIgnoreCase | ( | const char * | string | ) | const |
Compares the specified C string to this string ignoring the case of the characters and returns true if they are equal.
string | the C string to compare. |
Searches in this string for the first index of any character that is not in the specified String.
The search for the non-matching characters starts at the given index and moves towards the end of this string.
chars | the characters to find the first non-matching index of within this String. |
start | the starting offset. |
void decaf::lang::String::getChars | ( | int | srcBegin, |
int | srcEnd, | ||
char * | dest, | ||
int | destSize, | ||
int | destBegin | ||
) | const |
Copies characters from this String into the destination char array, starting from the given index.
srcBegin | Starting index in this String for the copy operation. |
srcEnd | The index at which the copy ends, this value is not copied. |
dest | The destination character array to copy the data to. |
destSize | The size of the destination array. |
destBegin | The offset into the destination array to start copying to. |
IndexOutOfBoundsException | if any of the following conditions are met: srcBegin or srcEnd are negative. srcBegin is greater than src end. srcEnd is greater than the length() destSize or destBegin are negative. destBegin + (srcEnd - srcBegin) is greater than destSize. |
int decaf::lang::String::hashCode | ( | ) | const |
int decaf::lang::String::indexOf | ( | char | value | ) | const |
Searches in this string for the first index of the specified character.
The search for the character starts at the beginning and moves towards the end of this string.
c | the character to find. |
int decaf::lang::String::indexOf | ( | char | value, |
int | start | ||
) | const |
Searches in this string for the index of the specified character.
The search for the character starts at the specified offset and moves towards the end of this string.
If the start value given is less than zero the search starts at the beginning of the string. If the start value is greater than the length of the string minus one is returned.
value | the character to find. |
start | the starting offset. |
Searches in this string for the first index of the specified string.
The search for the string starts at the beginning and moves towards the end of this string.
string | the string to find within this String. |
Searches in this string for the index of the specified string.
The search for the string starts at the specified offset and moves towards the end of this string.
subString | the string to find within this String. |
start | the starting offset. |
int decaf::lang::String::indexOf | ( | const std::string & | string | ) | const |
Searches in this String for the first index of the specified std::string.
The search for the string starts at the beginning and moves towards the end of this string.
string | the STL string to find within this String. |
int decaf::lang::String::indexOf | ( | const std::string & | subString, |
int | start | ||
) | const |
Searches in this string for the index of the specified std::string.
The search for the string starts at the specified offset and moves towards the end of this string.
subString | the STL string to find within this String. |
start | the starting offset. |
int decaf::lang::String::indexOf | ( | const char * | string | ) | const |
Searches in this String for the first index of the specified C string.
The search for the string starts at the beginning and moves towards the end of this string. If the given string pointer is NULL this method returns -1.
string | the C string to find within this String. |
int decaf::lang::String::indexOf | ( | const char * | subString, |
int | start | ||
) | const |
Searches in this string for the index of the specified C string.
The search for the string starts at the specified offset and moves towards the end of this string. If the given string pointer is NULL this method returns -1.
subString | the C string to find within this String. |
start | the starting offset. |
bool decaf::lang::String::isEmpty | ( | ) | const |
|
static |
Given a C String pointer return true if the value is either NULL or the string contained is empty.
int decaf::lang::String::lastIndexOf | ( | char | value | ) | const |
Searches in this string for the last index of the specified character.
The search for the character starts at the end and moves towards the beginning of this string.
value | the character to find. |
int decaf::lang::String::lastIndexOf | ( | char | value, |
int | start | ||
) | const |
Searches in this string for the index of the specified character.
The search for the character starts at the specified offset and moves towards the beginning of this string.
value | the character to find. |
start | the starting offset. |
Searches in this string for the last index of the specified string.
The search for the string starts at the end and moves towards the beginning of this string.
string | the string to find. |
Searches in this string for the index of the specified string.
The search for the string starts at the specified offset and moves towards the beginning of this string.
subString | the string to find. |
start | the starting offset. |
int decaf::lang::String::lastIndexOf | ( | const std::string & | string | ) | const |
Searches in this string for the last index of the specified std::string.
The search for the string starts at the end and moves towards the beginning of this string.
string | the STL string to find. |
int decaf::lang::String::lastIndexOf | ( | const std::string & | subString, |
int | start | ||
) | const |
Searches in this string for the index of the specified std::string.
The search for the string starts at the specified offset and moves towards the beginning of this string.
subString | the STL string to find. |
start | the starting offset. |
int decaf::lang::String::lastIndexOf | ( | const char * | string | ) | const |
Searches in this string for the last index of the specified C string.
The search for the string starts at the end and moves towards the beginning of this string.
string | the C string to find. |
int decaf::lang::String::lastIndexOf | ( | const char * | subString, |
int | start | ||
) | const |
Searches in this string for the index of the specified C string.
The search for the string starts at the specified offset and moves towards the beginning of this string.
subString | the C string to find. |
start | the starting offset. |
|
virtual |
Implements decaf::lang::CharSequence.
bool decaf::lang::String::operator!= | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the equals method to determine equality.
other | The string value to compare to this one. |
bool decaf::lang::String::operator!= | ( | const std::string & | other | ) | const |
Concatenation operators for the various string types.
The value of this string and the given string are concatenated and returned in a new String instance.
other | The string whose value is to be concatenated with this one. |
bool decaf::lang::String::operator< | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically less than the other.
other | The string value to compare to this one. |
bool decaf::lang::String::operator< | ( | const std::string & | other | ) | const |
bool decaf::lang::String::operator<= | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically less than or equal to the other.
other | The string value to compare to this one. |
bool decaf::lang::String::operator<= | ( | const std::string & | other | ) | const |
Assignment from another String instance.
The internal contents of this string now reference the same contents as the provided String. The original contents of this String are not altered in other String instances that reference it.
other | The other String to assign to this instance. |
Assignment from another std::string instance.
The internal contents of this string now reference a copy of the contents as the provided std::string. The original contents of this String are not altered in other String instances that reference it.
other | The other std::string to assign to this instance. |
Assignment from another C string instance.
The internal contents of this string now reference a copy of the contents as the provided C string. The original contents of this String are not altered in other String instances that reference it.
other | The other C string to assign to this instance. |
bool decaf::lang::String::operator== | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the equals method to determine equality.
other | The string value to compare to this one. |
bool decaf::lang::String::operator== | ( | const std::string & | other | ) | const |
bool decaf::lang::String::operator> | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically greater than the other.
other | The string value to compare to this one. |
bool decaf::lang::String::operator> | ( | const std::string & | other | ) | const |
bool decaf::lang::String::operator>= | ( | const char * | other | ) | const |
Comparison operators for the various string types that uses the compareTo method to determine if the string is lexicographically greater than or equal to the other.
other | The string value to compare to this one. |
bool decaf::lang::String::operator>= | ( | const std::string & | other | ) | const |
bool decaf::lang::String::regionMatches | ( | int | thisStart, |
const String & | string, | ||
int | start, | ||
int | length | ||
) | const |
Compares the specified string to this string and compares the specified range of characters to determine if they are the same.
The method returns false is any of the index values are negative or result in a span that would exceed the length of either string.
thisStart | the starting offset in this string. |
string | the string to compare. |
start | the starting offset in the specified string. |
length | the number of characters to compare. |
bool decaf::lang::String::regionMatches | ( | bool | ignoreCase, |
int | thisStart, | ||
const String & | string, | ||
int | start, | ||
int | length | ||
) | const |
Compares the specified string to this string and compares the specified range of characters to determine if they are the same.
When ignoreCase is true, the case of the characters is ignored during the comparison.
ignoreCase | specifies if case should be ignored. |
thisStart | the starting offset in this string. |
string | the string to compare. |
start | the starting offset in the specified string. |
length | the number of characters to compare. |
String decaf::lang::String::replace | ( | char | oldChar, |
char | newChar | ||
) | const |
Copies this string replacing occurrences of the specified character with another character.
oldChar | the character to replace. |
newChar | the replacement character. |
Compares the specified string to this string to determine if the specified string is a prefix.
If the prefix string is empty or is equal to this String than true is returned.
prefix | the string to look for. |
Compares the specified string to this string, starting at the specified offset, to determine if the specified string is a prefix.
prefix | the string to look for. |
start | the starting offset. |
|
virtual |
Returns a new CharSequence that is a subsequence of this sequence.The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.
start | The start index, inclusive. |
end | The end index, exclusive. |
IndexOutOfBoundsException | if start or end > length() or start or end are negative. |
Implements decaf::lang::CharSequence.
String decaf::lang::String::substring | ( | int | start | ) | const |
Copies a range of characters into a new string starting from the given offset and extending to the end of this String.
start | the offset of the first character. |
IndexOutOfBoundsException | if start < 0 or start > length(). |
String decaf::lang::String::substring | ( | int | start, |
int | end | ||
) | const |
Copies a range of characters into a new string.
The length of the returned String is end - start meaning that the characters in the new string include only start to end - 1.
start | the offset of the first character. (inclusive) |
end | the offset one past the last character. (exclusive) |
IndexOutOfBoundsException | if start < 0, start > end or end > length(). |
char* decaf::lang::String::toCharArray | ( | ) | const |
Copies the characters in this string to a newly allocated character array.
The returned array is the property of the caller and must be deleted by them. If the String is empty then a NULL is returned.
The array returned is not guaranteed to be null terminated as the array is sized according to the result of calling length().
String decaf::lang::String::toLowerCase | ( | ) | const |
Converts the characters in this string to lower case.
The resulting value is returned in a new String instance and this one is left unchanged.
|
virtual |
Implements decaf::lang::CharSequence.
String decaf::lang::String::toUpperCase | ( | ) | const |
Converts the characters in this string to upper case.
The resulting value is returned in a new String instance and this one is left unchanged.
String decaf::lang::String::trim | ( | ) | const |
Returns a copy of the string, with leading and trailing whitespace omitted.
|
static |
Returns a String that represents the value of the given boolean value.
value | The value whose string representation is to be returned. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
friend |