UCommon
string.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
2 // Copyright (C) 2015 Cherokees of Idaho.
3 //
4 // This file is part of GNU uCommon C++.
5 //
6 // GNU uCommon C++ is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published
8 // by the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // GNU uCommon C++ is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
18 
36 #ifndef _UCOMMON_STRING_H_
37 #define _UCOMMON_STRING_H_
38 
39 #ifndef _UCOMMON_CPR_H_
40 #include <ucommon/cpr.h>
41 #endif
42 
43 #ifndef _UCOMMON_GENERICS_H_
44 #include <ucommon/generics.h>
45 #endif
46 
47 #ifndef _UCOMMON_PROTOCOLS_H_
48 #include <ucommon/protocols.h>
49 #endif
50 
51 #ifndef _UCOMMON_OBJECT_H_
52 #include <ucommon/object.h>
53 #endif
54 
55 #include <stdio.h>
56 #include <string.h>
57 #include <stdarg.h>
58 
59 #ifdef HAVE_DIRENT_H
60 #include <dirent.h>
61 #endif
62 
63 #define PGP_B64_WIDTH 64
64 #define MIME_B64_WIDTH 76
65 
66 namespace ucommon {
67 
71 typedef unsigned short strsize_t;
72 
83 class __EXPORT String : public ObjectProtocol
84 {
85 protected:
97 public:
98  enum {
99  SENSITIVE = 0x00,
100  INSENSITIVE = 0x01
101  };
102 
103  class __EXPORT regex
104  {
105  private:
106  void *object;
107  void *results;
108  size_t count;
109 
110  __DELETE_COPY(regex);
111 
112  public:
113  regex(const char *pattern, size_t size = 1);
114  regex(size_t size = 1);
115  ~regex();
116 
117  size_t offset(unsigned member);
118  size_t size(unsigned member);
119 
120  inline size_t members(void) const
121  {return count;}
122 
123  bool match(const char *text, unsigned flags = 0);
124 
125  regex& operator=(const char *string);
126 
127  bool operator*=(const char *string);
128 
129  operator bool() const
130  {return object != NULL;}
131 
132  bool operator!() const
133  {return object == NULL;}
134  };
135 
136  class __EXPORT cstring : public CountedObject
137  {
138  private:
139  __DELETE_COPY(cstring);
140 
141  protected:
142  virtual void dealloc(void) __OVERRIDE;
143 
144  public:
145 #pragma pack(1)
146  strsize_t max;
147  strsize_t len;
148  char fill;
149  char text[1];
150 #pragma pack()
151 
157  cstring(strsize_t size);
158 
166  cstring(strsize_t size, char fill);
167 
175  void clear(strsize_t offset, strsize_t size);
176 
183  void set(strsize_t offset, const char *text, strsize_t size);
184 
189  void set(const char *text);
190 
195  void add(const char *text);
196 
201  void add(char character);
202 
206  void fix(void);
207 
212  void unfix(void);
213 
219  void inc(strsize_t number);
220 
226  void dec(strsize_t number);
227  };
228 
229 protected:
230  cstring *str;
238  cstring *create(strsize_t size, char fill = 0) const;
239 
240 public:
248  virtual int compare(const char *string) const;
249 
250  inline int collate(const char *string) const
251  {return compare(string);}
252 
253 protected:
259  bool equal(const char *string) const;
260 
265  virtual void retain(void) __OVERRIDE;
266 
271  virtual void release(void) __OVERRIDE;
272 
277  virtual cstring *c_copy(void) const;
278 
285  virtual void cow(strsize_t size = 0);
286 
287  strsize_t getStringSize(void) const;
288 
289 public:
290 #if _MSC_VER > 1400 // windows broken dll linkage issue...
291  const static strsize_t npos = ((strsize_t)-1);
292  const static char eos = '\0';
293 #else
294  static const strsize_t npos;
295  static const char eos;
296 #endif
297 
298 
302  String();
303 
308  String(long value);
309 
314  String(double value);
315 
320  String(strsize_t size);
321 
327  String(strsize_t size, char fill);
328 
336  String(strsize_t size, const char *format, ...) __PRINTF(3, 4);
337 
338 
343  String(const char *text);
344 
351  String(const char *text, strsize_t size);
352 
359  String(const char *text, const char *end);
360 
366  String(const String& existing);
367 
372  virtual ~String();
373 
380  String get(strsize_t offset, strsize_t size = 0) const;
381 
387  int scanf(const char *format, ...) __SCANF(2, 3);
388 
395  int vscanf(const char *format, va_list args) __SCANF(2, 0);
396 
402  strsize_t printf(const char *format, ...) __PRINTF(2, 3);
403 
410  strsize_t vprintf(const char *format, va_list args) __PRINTF(2, 0);
411 
416  char *c_mem(void) const;
417 
422  const char *c_str(void) const;
423 
429  virtual bool resize(strsize_t size);
430 
435  void set(const char *text);
436 
444  void set(strsize_t offset, const char *text, strsize_t size = 0);
445 
453  void set(const char *text, char overflow, strsize_t offset, strsize_t size = 0);
454 
462  void rset(const char *text, char overflow, strsize_t offset, strsize_t size = 0);
463 
468  void add(const char *text);
469 
474  void add(char character);
475 
480  void trim(const char *list);
481 
486  inline void trim(strsize_t count = 1)
487  {operator+=(count);}
488 
493  void chop(const char *list);
494 
499  inline void chop(strsize_t count = 1)
500  {operator-=(count);}
501 
506  void strip(const char *list);
507 
513  bool unquote(const char *quote);
514 
520  void cut(strsize_t offset, strsize_t size = 0);
521 
528  void paste(strsize_t offset, const char *text, strsize_t size = 0);
529 
535  void clear(strsize_t offset, strsize_t size = 0);
536 
540  void clear(void);
541 
545  void upper(void);
546 
550  void lower(void);
551 
555  void erase(void);
556 
562  strsize_t ccount(const char *list) const;
563 
568  strsize_t count(void) const;
569 
574  strsize_t size(void) const;
575 
585  strsize_t offset(const char *pointer) const;
586 
592  char at(int position) const;
593 
598  const char *begin(void) const;
599 
604  const char *end(void) const;
605 
612  const char *skip(const char *list, strsize_t offset = 0) const;
613 
621  const char *rskip(const char *list, strsize_t offset = npos) const;
622 
628  const char *search(const char *string, unsigned instance = 0, unsigned flags = 0) const;
629 
630  const char *search(regex& expr, unsigned instance = 0, unsigned flags = 0) const;
631 
632  unsigned replace(const char *string, const char *text = NULL, unsigned flags = 0);
633 
634  unsigned replace(regex& expr, const char *text = NULL, unsigned flags = 0);
635 
642  const char *find(const char *list, strsize_t offset = 0) const;
643 
650  const char *rfind(const char *list, strsize_t offset = npos) const;
651 
657  void split(const char *pointer);
658 
664  void split(strsize_t offset);
665 
671  void rsplit(const char *pointer);
672 
678  void rsplit(strsize_t offset);
679 
685  const char *chr(char character) const;
686 
693  const char *rchr(char character) const;
694 
699  strsize_t len(void) const;
700 
705  char fill(void);
706 
711  inline operator const char *() const
712  {return c_str();}
713 
718  inline const char *operator*() const
719  {return c_str();}
720 
725  bool full(void) const;
726 
733  String operator()(int offset, strsize_t size) const;
734 
740  inline String left(strsize_t size) const
741  {return operator()(0, size);}
742 
748  inline String right(strsize_t offset) const
749  {return operator()(-((int)offset), 0);}
750 
757  inline String copy(strsize_t offset, strsize_t size) const
758  {return operator()((int)offset, size);}
759 
767  const char *operator()(int offset) const;
768 
774  const char operator[](int offset) const;
775 
780  bool operator!() const;
781 
786  operator bool() const;
787 
793  String& operator^=(const String& object);
794 
799  String& operator|=(const char *text);
800 
801  String& operator&=(const char *text);
802 
808  String& operator+=(const char *text);
809 
815  String& operator^=(const char *text);
816 
821  String operator+(const char *text);
822 
829  String& operator|(const char *text);
830 
837  String& operator&(const char *text);
838 
845  String& operator=(const String& object);
846 
847  bool operator*=(const char *substring);
848 
849  bool operator*=(regex& expr);
850 
855  String& operator=(const char *text);
856 
860  String& operator++(void);
861 
866  String& operator+=(strsize_t number);
867 
871  String& operator--(void);
872 
877  String& operator-=(strsize_t number);
878 
883  String& operator*=(strsize_t number);
884 
890  bool operator==(const char *text) const;
891 
897  bool operator!=(const char *text) const;
898 
904  bool operator<(const char *text) const;
905 
911  bool operator<=(const char *text) const;
912 
918  bool operator>(const char *text) const;
919 
925  bool operator>=(const char *text) const;
926 
927  inline String& operator<<(const char *text)
928  {add(text); return *this;}
929 
930  inline String& operator<<(char code)
931  {add(code); return *this;}
932 
938  String &operator%(short& value);
939 
945  String &operator%(unsigned short& value);
946 
952  String &operator%(long& value);
953 
959  String &operator%(unsigned long& value);
960 
966  String &operator%(double& value);
967 
973  String &operator%(const char *text);
974 
980  static void swap(String& object1, String& object2);
981 
986  static void fix(String& object);
987 
995  static bool check(const char *string, size_t maximum, size_t minimum = 0);
996 
1001  static void erase(char *text);
1002 
1007  static void lower(char *text);
1008 
1013  static void upper(char *text);
1014 
1028  static char *token(char *text, char **last, const char *list, const char *quote = NULL, const char *end = NULL);
1029 
1036  static char *skip(char *text, const char *list);
1037 
1044  static char *rskip(char *text, const char *list);
1045 
1053  static char *unquote(char *text, const char *quote);
1054 
1062  static char *rset(char *buffer, size_t size, const char *text);
1063 
1072  static char *set(char *buffer, size_t size, const char *text);
1073 
1083  static char *set(char *buffer, size_t size, const char *text, size_t max);
1084 
1094  static char *add(char *buffer, size_t size, const char *text);
1095 
1106  static char *add(char *buffer, size_t size, const char *text, size_t max);
1107 
1115  static const char *ifind(const char *text, const char *key, const char *optional);
1116 
1124  static const char *find(const char *text, const char *key, const char *optional);
1125 
1131  static size_t count(const char *text);
1132 
1139  static int compare(const char *text1, const char *text2);
1140 
1141  static inline int collate(const char *text1, const char *text2)
1142  {return compare(text1, text2);}
1143 
1150  static bool equal(const char *text1, const char *text2);
1151 
1159  static int compare(const char *text1, const char *text2, size_t size);
1160 
1168  static bool equal(const char *text1, const char *text2, size_t size);
1169 
1176  static int case_compare(const char *text1, const char *text2);
1177 
1184  static bool eq_case(const char *text1, const char *text2);
1185 
1193  static int case_compare(const char *text1, const char *text2, size_t size);
1194 
1202  static bool eq_case(const char *text1, const char *text2, size_t size);
1203 
1211  static char *trim(char *text, const char *list);
1212 
1220  static char *chop(char *text, const char *list);
1221 
1229  static char *strip(char *text, const char *list);
1230 
1239  static char *fill(char *text, size_t size, char character);
1240 
1247  static unsigned ccount(const char *text, const char *list);
1248 
1255  static char *find(char *text, const char *list);
1256 
1263  static size_t seek(char *text, const char *list);
1264 
1271  static char *rfind(char *text, const char *list);
1272 
1278  static char *dup(const char *text);
1279 
1286  static char *left(const char *text, size_t size);
1287 
1294  static const char *pos(const char *text, ssize_t offset);
1295 
1296  inline static char *right(const char *text, size_t size)
1297  {return dup(pos(text, -(ssize_t)size));}
1298 
1299  inline static char *copy(const char *text, size_t offset, size_t len)
1300  {return left(pos(text, (ssize_t)offset), len);}
1301 
1302  static void cut(char *text, size_t offset, size_t len);
1303 
1304  static void paste(char *text, size_t max, size_t offset, const char *data, size_t len = 0);
1305 
1318  inline char *token(char **last, const char *list, const char *quote = NULL, const char *end = NULL)
1319  {return token(c_mem(), last, list, quote, end);}
1320 
1327  inline double tod(char **pointer = NULL)
1328  {return strtod(c_mem(), pointer);}
1329 
1336  inline long tol(char **pointer = NULL)
1337  {return strtol(c_mem(), pointer, 0);}
1338 
1345  inline static double tod(const char *text, char **pointer = NULL)
1346  {return strtod(text, pointer);}
1347 
1354  inline static long tol(const char *text, char **pointer = NULL)
1355  {return strtol(text, pointer, 0);}
1356 
1363  static String b64(const uint8_t *binary, size_t size);
1364 
1373  static size_t b64encode(char *string, const uint8_t *binary, size_t size, size_t width = 0);
1374 
1382  static size_t b64decode(uint8_t *binary, const char *string, size_t size);
1383 
1390  static uint32_t crc24(uint8_t *binary, size_t size);
1391 
1398  static uint16_t crc16(uint8_t *binary, size_t size);
1399 
1406  static String hex(const unsigned char *binary, size_t size);
1407 
1415  static unsigned hexdump(const unsigned char *binary, char *string, const char *format);
1416 
1424  static unsigned hexpack(unsigned char *binary, const char *string, const char *format);
1425 
1426  static unsigned hexsize(const char *format);
1427 };
1428 
1436 class __EXPORT memstring : public String
1437 {
1438 public:
1439 #if _MSC_VER > 1400 // windows broken dll linkage issue...
1440  const static size_t header = sizeof(String::cstring);
1441 #else
1442  static const size_t header;
1443 #endif
1444 
1445 private:
1446  bool resize(strsize_t size);
1447  void cow(strsize_t adj = 0);
1448  void release(void);
1449 
1450 protected:
1451  cstring *c_copy(void) const;
1452 
1453 public:
1458  inline void operator=(String& object)
1459  {set(object.c_str());}
1460 
1465  inline void operator=(const char *text)
1466  {set(text);}
1467 
1474  memstring(void *memory, strsize_t size, char fill = 0);
1475 
1479  ~memstring();
1480 
1486  static memstring *create(strsize_t size, char fill = 0);
1487 
1494  static memstring *create(MemoryProtocol *pager, strsize_t size, char fill = 0);
1495 };
1496 
1504 template<size_t S>
1505 class charbuf
1506 {
1507 private:
1508  char buffer[S];
1509 
1510 public:
1514  inline charbuf()
1515  {buffer[0] = 0;}
1516 
1522  inline charbuf(const char *text)
1523  {String::set(buffer, S, text);}
1524 
1528  inline charbuf(const charbuf& copy)
1529  {String::set(buffer, S, copy.buffer);}
1530 
1535  inline void operator=(const char *text)
1536  {String::set(buffer, S, text);}
1537 
1543  inline void operator+=(const char *text)
1544  {String::add(buffer, S, text);}
1545 
1550  inline operator bool() const
1551  {return buffer[0];}
1552 
1557  inline bool operator!() const
1558  {return buffer[0] == 0;}
1559 
1564  inline operator char *()
1565  {return buffer;}
1566 
1571  inline char *operator*()
1572  {return buffer;}
1573 
1579  inline char& operator[](size_t offset) const
1580  {return buffer[offset];}
1581 
1587  inline char *operator()(size_t offset)
1588  {return buffer + offset;}
1589 
1594  inline size_t size(void) const
1595  {return S;}
1596 
1601  inline size_t len(void) const
1602  {return strlen(buffer);}
1603 };
1604 
1609 
1610 typedef String::regex stringex_t;
1611 
1622 template<strsize_t S>
1623 class stringbuf : public memstring
1624 {
1625 private:
1626  char buffer[sizeof(cstring) + S];
1627 
1628 public:
1632  inline stringbuf() : memstring(buffer, S) {}
1633 
1638  inline stringbuf(const char *text) : memstring(buffer, S) {set(text);}
1639 
1644  inline void operator=(const char *text)
1645  {set(text);}
1646 
1651  inline void operator=(String& object)
1652  {set(object.c_str());}
1653 };
1654 
1655 #if !defined(_MSWINDOWS_) && !defined(__QNX__)
1656 
1657 #ifndef stricmp
1658 #define stricmp(x,y) String::case_compare(x,y)
1659 #endif
1660 
1661 #ifndef strnicmp
1662 #define strnicmp(x,y,z) String::case_compare(x,y,z)
1663 #endif
1664 
1665 #endif
1666 
1673 inline bool eq(char const *s1, char const *s2)
1674  {return String::equal(s1, s2);}
1675 
1676 inline bool ne(char const *s1, char const *s2)
1677  {return !String::equal(s1, s2);}
1678 
1686 inline bool eq(char const *s1, char const *s2, size_t size)
1687  {return String::equal(s1, s2, size);}
1688 
1689 inline bool ne(char const *s1, char const *s2, size_t size)
1690  {return !String::equal(s1, s2, size);}
1691 
1701 inline bool eq(String &s1, const char *s2)
1702  {return s1.compare(s2) == 0;}
1703 
1704 inline bool ne(String &s1, String &s2)
1705  {return s1.compare(s2) != 0;}
1706 
1707 inline bool lt(String &s1, const char *s2)
1708  {return s1.compare(s2) < 0;}
1709 
1710 inline bool gt(String &s1, const char *s2)
1711  {return s1.compare(s2) > 0;}
1712 
1713 inline bool le(String &s1, const char *s2)
1714  {return s1.compare(s2) <= 0;}
1715 
1716 inline bool ge(String &s1, const char *s2)
1717  {return s1.compare(s2) >= 0;}
1718 
1726 inline bool eq_case(char const *s1, char const *s2)
1727  {return String::eq_case(s1, s2);}
1728 
1729 inline bool ne_case(char const *s1, char const *s2)
1730  {return !String::eq_case(s1, s2);}
1731 
1740 inline bool eq_case(char const *s1, char const *s2, size_t size)
1741  {return String::eq_case(s1, s2, size);}
1742 
1743 inline String str(const char *string)
1744  {return (String)string;}
1745 
1746 inline String str(String& string)
1747  {return (String)string;}
1748 
1749 inline String str(short value)
1750  {String temp(16, "%hd", value); return temp;}
1751 
1752 inline String str(unsigned short value)
1753  {String temp(16, "%hu", value); return temp;}
1754 
1755 inline String str(long value)
1756  {String temp(32, "%ld", value); return temp;}
1757 
1758 inline String str(unsigned long value)
1759  {String temp(32, "%lu", value); return temp;}
1760 
1761 inline String str(double value)
1762  {String temp(40, "%f", value); return temp;}
1763 
1764 String str(CharacterProtocol& cp, strsize_t size);
1765 
1766 template<>
1767 inline void swap<string_t>(string_t& s1, string_t& s2)
1768  {String::swap(s1, s2);}
1769 
1770 class __EXPORT strdup_t
1771 {
1772 private:
1773  char *data;
1774 
1775 public:
1776  inline strdup_t()
1777  {data = NULL;}
1778 
1779  inline strdup_t(char *str)
1780  {data = str;}
1781 
1782  inline ~strdup_t()
1783  {if(data) ::free(data);}
1784 
1785  inline strdup_t& operator=(char *str)
1786  {if(data) ::free(data); data = str; return *this;}
1787 
1788  inline operator bool() const
1789  {return data != NULL;}
1790 
1791  inline bool operator!() const
1792  {return data == NULL;}
1793 
1794  inline operator char*() const
1795  {return data;}
1796 
1797  inline const char *c_str(void) const
1798  {return data;}
1799 
1800  inline const char *operator*() const
1801  {return data;}
1802 
1803  inline char& operator[](int size)
1804  {return data[size];}
1805 
1806  inline char *operator+(size_t size)
1807  {return data + size;}
1808 };
1809 
1810 } // namespace ucommon
1811 
1812 #endif
A common string class and character string support functions.
void release(SharedAccess &object)
Convenience function to unlock shared object through it's protocol.
Definition: access.h:280
cstring * str
cstring instance our object references.
Definition: string.h:230
void add(const char *text)
Append null terminated text to our string buffer.
A base class for reference counted objects.
Definition: object.h:56
A string class that has a predefined string buffer.
Definition: string.h:1623
charbuf(const charbuf &copy)
Copy constructor.
Definition: string.h:1528
const char * c_str(void) const
Get character text buffer of string object.
stringbuf()
Create an empty instance of a string buffer.
Definition: string.h:1632
void operator+=(const char *text)
Concatenate text into the object.
Definition: string.h:1543
double tod(char **pointer=((void *) 0))
Convert string to a double value.
Definition: string.h:1327
void operator=(String &object)
Assign the text of a string to our object.
Definition: string.h:1458
void operator=(String &object)
Assign a string buffer from another string object.
Definition: string.h:1651
const char * operator*() const
Reference raw text buffer by pointer operator.
Definition: string.h:718
String right(strsize_t offset) const
Convenience method for right of string.
Definition: string.h:748
charbuf(const char *text)
Create a character buffer with assigned text.
Definition: string.h:1522
unsigned short strsize_t
A convenience class for size of strings.
Definition: string.h:71
ObjectProtocol * copy(ObjectProtocol *object)
Convenience function to access object copy.
Definition: object.h:510
A copy-on-write string class that operates by reference count.
Definition: string.h:83
void chop(strsize_t count=1)
Chop trailing characters from text.
Definition: string.h:499
static double tod(const char *text, char **pointer=((void *) 0))
Convert text to a double value.
Definition: string.h:1345
bool eq(const struct sockaddr *s1, const struct sockaddr *s2)
Compare two socket addresses to see if equal.
Definition: socket.h:2025
char * operator*()
Get text by object pointer reference.
Definition: string.h:1571
T * dup(const T &object)
Convenience function to duplicate object pointer to heap.
Definition: generics.h:324
bool eq_case(char const *s1, char const *s2)
Compare two null terminated strings if equal ignoring case.
Definition: string.h:1726
size_t len(void) const
Get current length of string.
Definition: string.h:1601
A common base class for all managed objects.
Definition: protocols.h:545
void set(const char *text)
Set string object to text of a null terminated string.
A common object base class with auto-pointer support.
long tol(char **pointer=((void *) 0))
Convert string to a long value.
Definition: string.h:1336
size_t size(void) const
Get allocated size of the object.
Definition: string.h:1594
void swap(T &o1, T &o2)
Convenience function to swap objects.
Definition: generics.h:387
Generic smart pointer class.
Definition: generics.h:54
static bool eq_case(const char *text1, const char *text2)
Simple case insensitive equal test for strings.
A template to create a character array that can be manipulated as a string.
Definition: string.h:1505
virtual int compare(const char *string) const
Compare the values of two string.
static long tol(const char *text, char **pointer=((void *) 0))
Convert text to a long value.
Definition: string.h:1354
Common namespace for all ucommon objects.
Definition: access.h:47
char * token(char **last, const char *list, const char *quote=((void *) 0), const char *end=((void *) 0))
A thread-safe token parsing routine for strings objects.
Definition: string.h:1318
void retain(ObjectProtocol *object)
Convenience function to access object retention.
Definition: object.h:492
static void swap(String &object1, String &object2)
Swap the cstring references between two strings.
bool equal(const char *string) const
Test if two string values are equal.
charbuf()
Create a new character buffer with an empty string.
Definition: string.h:1514
Mempager managed type factory for pager pool objects.
Definition: memory.h:1345
char * operator()(size_t offset)
Get a pointer to an offset in the object by expression operator.
Definition: string.h:1587
bool operator!() const
Test if the object is empty.
Definition: string.h:1557
String string_t
A convenience type for string.
Definition: string.h:1608
void operator=(const char *text)
Assign null terminated text to our object.
Definition: string.h:1465
A string class that uses a cstring buffer that is fixed in memory.
Definition: string.h:1436
stringbuf(const char *text)
Create a string buffer from a null terminated string.
Definition: string.h:1638
T &() max(T &o1, T &o2)
Convenience function to return max of two objects.
Definition: generics.h:414
Abstract interfaces and support.
char & operator[](size_t offset) const
Array operator to get a character from the object.
Definition: string.h:1579
Generic templates for C++.
Runtime functions.
String left(strsize_t size) const
Convenience method for left of string.
Definition: string.h:740
void operator=(const char *text)
Assign a string buffer from a null terminated string.
Definition: string.h:1644
String copy(strsize_t offset, strsize_t size) const
Convenience method for substring extraction.
Definition: string.h:757
void operator=(const char *text)
Assign null terminated text to the object.
Definition: string.h:1535