23 #ifndef COSA_STRING_HH 24 #define COSA_STRING_HH 44 typedef void (
String::*StringIfHelperType)()
const;
45 void StringIfHelper()
const {}
53 String(
const char *cstr =
"");
62 explicit String(
unsigned char,
unsigned char base=10);
63 explicit String(
int,
unsigned char base=10);
64 explicit String(
unsigned int,
unsigned char base=10);
65 explicit String(
long,
unsigned char base=10);
66 explicit String(
unsigned long,
unsigned char base=10);
67 explicit String(
float,
unsigned char decimalPlaces=2);
68 explicit String(
double,
unsigned char decimalPlaces=2);
78 unsigned char reserve(
unsigned int size);
83 inline unsigned int length(
void)
const 108 unsigned char concat(
const char *cstr);
109 unsigned char concat(
char c);
110 unsigned char concat(
unsigned char c);
111 unsigned char concat(
int num);
112 unsigned char concat(
unsigned int num);
113 unsigned char concat(
long num);
114 unsigned char concat(
unsigned long num);
115 unsigned char concat(
float num);
116 unsigned char concat(
double num);
151 operator StringIfHelperType()
const 153 return m_buffer ? &String::StringIfHelper : 0;
158 unsigned char equals(
const char *cstr)
const;
175 char charAt(
unsigned int index)
const;
176 void setCharAt(
unsigned int index,
char c);
179 void getBytes(
unsigned char* buf,
unsigned int bufsize,
unsigned int index = 0)
const;
181 void toCharArray(
char* buf,
unsigned int bufsize,
unsigned int index = 0)
const 183 getBytes((
unsigned char*) buf, bufsize, index);
192 int indexOf(
char ch,
unsigned int fromIndex)
const;
194 int indexOf(
const String &str,
unsigned int fromIndex)
const;
196 int lastIndexOf(
char ch,
unsigned int fromIndex)
const;
203 String substring(
unsigned int beginIndex,
unsigned int endIndex)
const;
214 void remove(
unsigned int index);
215 void remove(
unsigned int index,
unsigned int count);
223 long toInt(
void)
const;
234 unsigned char concat(
const char *cstr,
unsigned int length);
String substring(unsigned int beginIndex) const
__StringSumHelper(float num)
__StringSumHelper(char c)
unsigned char equalsIgnoreCase(const String &s) const
String & operator+=(float num)
char charAt(unsigned int index) const
String substring(unsigned int beginIndex, unsigned int endIndex) const
int compareTo(const String &s) const
float toFloat(void) const
String & operator+=(unsigned char num)
const char * c_str() const
void print(int value, Base base=dec)
int lastIndexOf(char ch) const
unsigned char equals(const String &s) const
__StringSumHelper(unsigned int num)
String & operator+=(const String &rhs)
unsigned char changeBuffer(unsigned int maxStrLen)
String & operator=(const String &rhs)
unsigned char operator>=(const String &rhs) const
unsigned char reserve(unsigned int size)
String & operator+=(str_P str)
unsigned char operator<=(const String &rhs) const
unsigned int m_capacity
the array length minus one (for the '\0')
char operator[](unsigned int index) const
String & copy(const char *cstr, unsigned int length)
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const
String(const char *cstr="")
String & operator+=(const char *cstr)
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
__StringSumHelper(const String &s)
unsigned char operator==(const char *cstr) const
__StringSumHelper(const char *p)
unsigned int length(void) const
String & operator+=(double num)
unsigned char operator<(const String &rhs) const
unsigned char operator!=(const char *cstr) const
const class prog_str * str_P
String & operator+=(unsigned long num)
void setCharAt(unsigned int index, char c)
unsigned char endsWith(const String &suffix) const
String & operator+=(long num)
__StringSumHelper(long num)
int indexOf(char ch) const
String & operator+=(int num)
char * m_buffer
the actual char array
unsigned char operator==(const String &rhs) const
unsigned int m_length
the String length (not counting the '\0')
String & operator+=(unsigned int num)
__StringSumHelper(unsigned long num)
unsigned char operator>(const String &rhs) const
unsigned char concat(const String &str)
__StringSumHelper(unsigned char num)
unsigned char operator!=(const String &rhs) const
void replace(char find, char replace)
String & operator+=(char c)
IOStream & operator<<(IOStream &outs, String &s)
__StringSumHelper(int num)
__StringSumHelper(double num)
friend __StringSumHelper & operator+(const __StringSumHelper &lhs, const String &rhs)
unsigned char startsWith(const String &prefix) const