52 m_string = mid (n, -1).std_string(); |
52 m_string = mid (n, -1).std_string(); |
53 } |
53 } |
54 |
54 |
55 // ------------------------------------------------------------------------------------------------- |
55 // ------------------------------------------------------------------------------------------------- |
56 // |
56 // |
57 String String::strip (const List<char>& unwanted) |
57 String String::strip (char unwanted) const |
|
58 { |
|
59 String result (m_string); |
|
60 |
|
61 for (int pos = 0; (pos = result.find (unwanted)) != -1;) |
|
62 result.remove_at (pos--); |
|
63 |
|
64 return result; |
|
65 } |
|
66 |
|
67 // ------------------------------------------------------------------------------------------------- |
|
68 // |
|
69 String String::strip (const List<char>& unwanted) const |
58 { |
70 { |
59 String result (m_string); |
71 String result (m_string); |
60 |
72 |
61 for (int i = 0; i < unwanted.size(); ++i) |
73 for (int i = 0; i < unwanted.size(); ++i) |
62 { |
74 { |
210 // ------------------------------------------------------------------------------------------------- |
222 // ------------------------------------------------------------------------------------------------- |
211 // |
223 // |
212 int String::find (const char* c, int a) const |
224 int String::find (const char* c, int a) const |
213 { |
225 { |
214 int pos = m_string.find (c, a); |
226 int pos = m_string.find (c, a); |
|
227 |
|
228 if (pos == int (std::string::npos)) |
|
229 return -1; |
|
230 |
|
231 return pos; |
|
232 } |
|
233 |
|
234 // ------------------------------------------------------------------------------------------------- |
|
235 // |
|
236 int String::find (char ch, int a) const |
|
237 { |
|
238 int pos = m_string.find (ch, a); |
215 |
239 |
216 if (pos == int (std::string::npos)) |
240 if (pos == int (std::string::npos)) |
217 return -1; |
241 return -1; |
218 |
242 |
219 return pos; |
243 return pos; |