sources/mystring.h

branch
protocol5
changeset 159
970d58a01e8b
parent 150
37db42ad451a
parent 158
de7574d292ad
child 195
be953e1621d9
equal deleted inserted replaced
155:9f71f854474a 159:970d58a01e8b
91 void __cdecl sprintf(const char* fmtstr, ...); 91 void __cdecl sprintf(const char* fmtstr, ...);
92 bool startsWith(const String &other) const; 92 bool startsWith(const String &other) const;
93 const std::string& stdString() const; 93 const std::string& stdString() const;
94 void strip(char unwanted); 94 void strip(char unwanted);
95 void strip(const List<char> &unwanted); 95 void strip(const List<char> &unwanted);
96 const unsigned char* toBytes() const;
96 double toDouble(bool* ok = nullptr) const; 97 double toDouble(bool* ok = nullptr) const;
97 float toFloat(bool* ok = nullptr) const; 98 float toFloat(bool* ok = nullptr) const;
98 long toInt(bool* ok = nullptr, int base = 10) const; 99 long toInt(bool* ok = nullptr, int base = 10) const;
99 String toLowerCase() const; 100 String toLowerCase() const;
100 String toUpperCase() const; 101 String toUpperCase() const;
105 static String fromNumber(long int a); 106 static String fromNumber(long int a);
106 static String fromNumber(unsigned short int a); 107 static String fromNumber(unsigned short int a);
107 static String fromNumber(unsigned int a); 108 static String fromNumber(unsigned int a);
108 static String fromNumber(unsigned long int a); 109 static String fromNumber(unsigned long int a);
109 static String fromNumber(double a); 110 static String fromNumber(double a);
111 static String fromBytes(const ByteArray& bytes);
110 112
111 String operator+(const String& data) const; 113 String operator+(const String& data) const;
112 String operator+(const char* data) const; 114 String operator+(const char* data) const;
113 String operator+(int num) const; 115 String operator+(int num) const;
114 String& operator+=(const String& data); 116 String& operator+=(const String& data);
551 { 553 {
552 return stdString(); 554 return stdString();
553 } 555 }
554 556
555 /*! 557 /*!
558 * \returns the underlying char-array representation of this string, casted to unsigned chars.
559 */
560 inline const unsigned char* String::toBytes() const
561 {
562 return reinterpret_cast<const unsigned char*>(chars());
563 }
564
565 /*!
556 * \brief Constructs an empty string list. 566 * \brief Constructs an empty string list.
557 */ 567 */
558 inline StringList::StringList() {} 568 inline StringList::StringList() {}
559 569
560 /*! 570 /*!

mercurial