????3????????????????÷??????????????Ч??????

????????ú??????????string?????????????????????????????????????????????????ο??????????????????????????string???????????????У???????·??????????????????????????С??????????????????????????????÷?????????????????????????????????????????????????????????????????????????????

????????????????????????????е???????????£???????????????????????????????????ж????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????????????????????????ó???????????ú????????????????????????????????????????ò?????辶???????????Ч?????????????????????????潫??????????????Java????C++???????????????????????????′?????Σ?

1     String getName() {
2         return _name;  //????_name????????????????char*??????String??
3     }

??????????Java???????????????????п???????Java??????????????????String??????????????

??????????????????л?????????????????????????????????????????????????????????????????????????????Щ?????е???????C++??????????????????????е?????????????????C++????(?????Java)???????????????????????????????????????????????????????????????????????????????е??С???????????鷳???????????????????????????

?????????????Java?е?String???????????????з????????????????????書?????????????????????????????????C++?????????????string?????????????棬????JVM?String????????????????????????????????Java?????У???????????κζ????????????????

?????????????????????????????Java??String??????????ù????????C++????????????????????String????????????????????????????Ч?????????????????????????????У????к???????????????????????????????????????????????????????????????????????????????Java?????????????C++????μ???????String??????????и?????????????????′?????????

class String
 {
 public:
     String();
     String(const String& other);
     String(const char* otherText);
     String(const char otherChar);
     String(const char* otherText?? const int count);
     String(const char* otherText?? const int offset?? const int count);
     explicit String(const int value);
     explicit String(const int64 value);
     explicit String(const double value);
     ~String();
 
 public:
     const String& operator= (const String& other);
     const String& operator= (const char* otherText);
     const String& operator= (const char otherChar);
     const String& operator+= (const String& other);
     const String& operator+= (const char* otherText);
     const String& operator+= (const char otherChar);
     const String  operator+ (const String& other) const;
     const String  operator+ (const char* otherText) const;
     const String  operator+ (const char otherChar) const;
     String& operator<< (const String& other);
     String& operator<< (const char* otherText);
     String& operator<< (const char otherChar);
     String& operator<< (const int otherDecimal);
     String& operator<< (const int64 otherDecimal);
     String& operator<< (const float otherDecimal);
     String& operator<< (const double otherDecimal);
     bool operator== (const String& other) const;
     bool operator== (const char* otherText) const;
     bool operator== (const char otherChar) const;
     bool operator!= (const String& other) const;
     bool operator!= (const char* otherText) const;
     bool operator!= (const char otherChar) const;
     bool operator> (const String& other) const;
     bool operator> (const char* otherText) const;
     bool operator> (const char otherChar) const;
     bool operator>= (const String& other) const;
     bool operator>= (const char* otherText) const;
     bool operator>= (const char otherChar) const;
     bool operator< (const String& other) const;
     bool operator< (const char* otherText) const;
     bool operator< (const char otherChar) const;
     bool operator<= (const String& other) const;
     bool operator<= (const char* otherText) const;
     bool operator<= (const char otherChar) const;
     const char operator[] (const int index) const;
     operator const char*() const;
 
 public:
     void append(const char* otherText??int count = -1);
     bool isEmpty() const;
     size_t length() const;
     size_t capacity() const;
     bool equals(const char* otherText??const size_t count??bool ignoreCase) const;
     bool equalsIgnoreCase(const String& other) const;
     bool equalsIgnoreCase(const char* otherText) const;
     bool equalsIgnoreCase(const char otherChar) const;
     int compareIgnoreCase(const String& other) const;
     int compareIgnoreCase(const char* otherText) const;
     int compareIgnoreCase(const char otherChar) const;
     bool startsWith(const char* otherText?? bool ignoreCase) const;
     bool startsWith(const char otherChar?? bool ignoreCase) const;
     bool endsWith(const char* otherText?? bool ignoreCase) const;
     bool endsWith(const char otherChar?? bool ignoreCase) const;
     String toUpperCase() const;
     String toLowerCase() const;
     const String substring(const int startPos?? const int count) const;
     const String substring(const int startPos) const;
     bool contains(const char* childText?? bool ignoreCase) const;
     bool contains(const char childChar?? bool ignoreCase) const;
     bool containsAnyOf(const char* childText) const;
     int indexOf(const char* childText?? bool ignoreCase) const;
     int indexOf(const char childChar?? bool ignoreCase) const;
     int indexOf(const int startPos??const char* childText?? bool ignoreCase) const;
     int indexOf(const int startPos??const char childChar?? bool ignoreCase) const;
     int indexAnyOf(const char* childText?? bool ignoreCase) const;
     int indexAnyOf(const int startPos?? const char* childText?? bool ignoreCase) const;
     int lastIndexOf(const char* childText?? bool ignoreCase) const;
     int lastIndexOf(const char childChar?? bool ignoreCase) const;
     int lastIndexAnyOf(const char* childText?? bool ignoreCase) const;
     String trim() const;
     String ltrim() const;
     String rtrim() const;
     String insert(const int pos??const char newChar) const;
     String insert(const int pos??const char* newText) const;
     String replace(int startPos??int count??const char* newText??const int textCount);
     int toIntValue(bool* ok = 0) const;
     int64 toInt64Value(bool* ok = 0) const;
     double toDoubleValue(bool* ok = 0) const;
     bool toBoolValue() const;
     const char* text() const;
 
 private:
     const char* _buffer;
     size_t _dataLength;
 }