61 String(
int p_nLen = cn_default_str_len);
63 String(
const char* p_str,
int nLen);
72 char* Reset(
int nLen);
76 char *
End()
const {
return m_pBuffer + strlen(m_pBuffer) - 1; }
78 int GetSize()
const {
return m_nBufSize; }
82 void Clean() { m_pBuffer[0] =
'\0'; }
84 const char* Format(
const char* p_pMessage, ...);
86 void operator = (
const String &p_str);
88 void operator = (
const char *pStr);
90 operator char*()
const {
return m_pBuffer; }
92 char &operator[] (
int i)
const {
return m_pBuffer[i]; }
94 bool operator >(
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) > 0; }
96 bool operator < (
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) < 0; }
97 bool operator >= (
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) >= 0; }
98 bool operator <= (
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) <= 0; }
99 bool operator == (
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) == 0; }
100 bool operator != (
const String &p_str) {
return strcmp(m_pBuffer, p_str.m_pBuffer) != 0; }
102 String operator += (
const String &str) { strcat(Reset(strlen(m_pBuffer) + strlen(str) + 1), str.m_pBuffer);
return *
this; }
105 bool operator > (
const char *p) {
return strcmp(m_pBuffer, p) > 0; }
107 bool operator < (
const char *p) {
return strcmp(m_pBuffer, p) < 0; }
108 bool operator >= (
const char *p) {
return strcmp(m_pBuffer, p) >= 0; }
109 bool operator <= (
const char *p) {
return strcmp(m_pBuffer, p) <= 0; }
110 bool operator == (
const char *p) {
return strcmp(m_pBuffer, p) == 0; }
111 bool operator != (
const char *p) {
return strcmp(m_pBuffer, p) != 0; }
113 String operator += (
const char *p) { strcat(Reset(strlen(m_pBuffer) + strlen(p) + 1), p);
return *
this; }
123 return String(str1) += str2;
130 void DeleteSub(
int nLocal,
int nLen);
132 int Find(
const char *sub);
134 String Replace(
const char *src,
const char *rpl);
136 inline char *TokBegin(
const char *p);
138 inline char *TokSub(
const char *p);
int GetSize() const
get buffer size
const int cn_default_max_len
default maximum length
char * End() const
get the pointer to the last position
const int cn_default_str_len
default length of string
void Clean()
set the string = "", but donot release the buffer
int GetLength() const
get string length
char * GetBuffer() const
get buffer
define all the code written by Bin Wang.
Defination of simple dynamic array/stack/queue and so on.