sources/mystring.h

changeset 110
cad1163333b9
parent 109
e4966d7e615d
child 129
a556ce001e26
equal deleted inserted replaced
109:e4966d7e615d 110:cad1163333b9
67 ConstIterator begin() const { return m_string.cbegin(); } 67 ConstIterator begin() const { return m_string.cbegin(); }
68 int compare (const String &other) const; 68 int compare (const String &other) const;
69 int count (char needle) const; 69 int count (char needle) const;
70 const char* chars() const { return m_string.c_str(); } 70 const char* chars() const { return m_string.c_str(); }
71 ConstIterator end() const { return m_string.end(); } 71 ConstIterator end() const { return m_string.end(); }
72 int find (const char*c, int a = 0) const; 72 int find (const char* c, int a = 0) const;
73 int find (char ch, int a = 0) const;
73 bool is_empty() const { return m_string[0] == '\0'; } 74 bool is_empty() const { return m_string[0] == '\0'; }
74 bool is_numeric() const; 75 bool is_numeric() const;
75 int find_last (const char*c, int a) const; 76 int find_last (const char*c, int a) const;
76 int length() const { return m_string.length(); } 77 int length() const { return m_string.length(); }
77 bool mask_against (const String &pattern) const; 78 bool mask_against (const String &pattern) const;
79 String mid (long a, long b) const; 80 String mid (long a, long b) const;
80 String right (int length) const; 81 String right (int length) const;
81 StringList split (const String &del) const; 82 StringList split (const String &del) const;
82 StringList split (char del) const; 83 StringList split (char del) const;
83 const std::string& std_string() const { return m_string; } 84 const std::string& std_string() const { return m_string; }
85 String strip (char unwanted) const;
86 String strip (const List<char> &unwanted) const;
84 double to_double (bool* ok = nullptr) const; 87 double to_double (bool* ok = nullptr) const;
85 float to_float (bool* ok = nullptr) const; 88 float to_float (bool* ok = nullptr) const;
86 long to_int (bool* ok = nullptr, int base = 10) const; 89 long to_int (bool* ok = nullptr, int base = 10) const;
87 String to_lowercase() const; 90 String to_lowercase() const;
88 String to_uppercase() const; 91 String to_uppercase() const;
110 void replace (int pos, int n, const String &a) { m_string.replace (pos, n, a.chars()); } 113 void replace (int pos, int n, const String &a) { m_string.replace (pos, n, a.chars()); }
111 void shrink_to_fit() { m_string.shrink_to_fit(); } 114 void shrink_to_fit() { m_string.shrink_to_fit(); }
112 void __cdecl sprintf (const char* fmtstr, ...); 115 void __cdecl sprintf (const char* fmtstr, ...);
113 void vsprintf (const char* fmtstr, va_list args); 116 void vsprintf (const char* fmtstr, va_list args);
114 bool starts_with (const String &other) const; 117 bool starts_with (const String &other) const;
115 String strip (char unwanted) { return strip ({unwanted}); }
116 String strip (const List<char> &unwanted);
117 void trim (int n); 118 void trim (int n);
118 119
119 static String from_number (short int a); 120 static String from_number (short int a);
120 static String from_number (int a); 121 static String from_number (int a);
121 static String from_number (long int a); 122 static String from_number (long int a);

mercurial