| 255 | } |
| 256 | |
| 257 | String SubString(int id, int len) const |
| 258 | { |
| 259 | if (len == 0) |
| 260 | return ""; |
| 261 | if (id + len > length) |
| 262 | len = length - id; |
| 263 | #if _DEBUG |
| 264 | if (id < 0 || id >= length || (id + len) > length) |
| 265 | throw "SubString: index out of range."; |
| 266 | if (len < 0) |
| 267 | throw "SubString: length less than zero."; |
| 268 | #endif |
| 269 | String res; |
| 270 | res.buffer = new char[len + 1]; |
| 271 | res.length = len; |
| 272 | strncpy_s(res.buffer.Ptr(), len + 1, buffer + id, len); |
| 273 | res.buffer[len] = 0; |
| 274 | return res; |
| 275 | } |
| 276 | |
| 277 | const char * Buffer() const |
| 278 | { |
no test coverage detected