9 int strnicmp(const char*, const char*, int);
11 class eString : public std::string
16 inline eString(const char* p);
17 inline eString(const char* p, int cnt);
18 inline eString(const std::string &s);
20 inline eString left(unsigned int len) const;
21 inline eString mid(unsigned int index, unsigned int len=(unsigned)-1) const;
22 inline eString right(unsigned int len) const;
25 inline operator bool() const;
26 inline bool operator!() const;
27 // methods with implementation in estring.cpp
28 eString& sprintf(char *fmt, ...);
29 eString& setNum(int val, int sys=10);
30 eString& removeChars(const char fchar);
31 eString& strReplace(const char* fstr, const eString& rstr);
33 int icompare(const eString& s);
36 eString convertDVBUTF8(unsigned char *data, int len, int table=5);
37 eString convertUTF8DVB(const eString &string); // with default ISO8859-5
38 eString convertLatin1UTF8(const eString &string);
39 int isUTF8(const eString &string);
41 /////////////////////////////////////////////// Copy Constructors ////////////////////////////////////////////////
42 inline eString::eString(const std::string &s)
47 inline eString::eString(const char* p)
48 :std::string(p?p:"") // when the char* p is null, than use ""... otherwise crash...
52 inline eString::eString(const char* p, int cnt)
57 ///////////////////////////////////////// eString operator bool /////////////////////////////////////////////////
58 inline eString::operator bool() const
60 // Returns a bool that contains true if the string longer than 0 Character otherwise false;
64 ///////////////////////////////////////// eString operator! ////////////////////////////////////////////////////
65 inline bool eString::operator!() const
67 // Returns a bool that contains true if the string ist empty otherwise false;
71 ///////////////////////////////////////// eString left //////////////////////////////////////////////////////////
72 inline eString eString::left(unsigned int len) const
74 // Returns a substring that contains the len leftmost characters of the string.
75 // The whole string is returned if len exceeds the length of the string.
76 return len >= length() ? *this : substr(0, len);
79 //////////////////////////////////////// eString mid ////////////////////////////////////////////////////////////
80 inline eString eString::mid(unsigned int index, unsigned int len) const
82 // Returns a substring that contains the len characters of this string, starting at position index.
83 // Returns a null string if the string is empty or index is out of range. Returns the whole string from index if index+len exceeds the length of the string.
84 register unsigned int strlen = length();
89 if (len == (unsigned)-1)
92 if (strlen < index + len)
95 return substr(index, len);
98 //////////////////////////////////////// eString right ////////////////////////////////////////////////////////////
99 inline eString eString::right(unsigned int len) const
101 // Returns a substring that contains the len rightmost characters of the string.
102 // The whole string is returned if len exceeds the length of the string.
103 register unsigned int strlen = length();
104 return len >= strlen ? *this : substr(strlen-len, len);
107 inline bool eString::isNull() const
109 // Returns a bool, that contains true, when the internal char* is null (only when a string ist empty constructed)
113 #endif // __E_STRING__