| 4265 | } |
| 4266 | |
| 4267 | String String::indent(const String &p_prefix) const { |
| 4268 | String new_string; |
| 4269 | int line_start = 0; |
| 4270 | |
| 4271 | for (int i = 0; i < length(); i++) { |
| 4272 | const char32_t c = operator[](i); |
| 4273 | if (c == '\n') { |
| 4274 | if (i == line_start) { |
| 4275 | new_string += c; // Leave empty lines empty. |
| 4276 | } else { |
| 4277 | new_string += p_prefix + substr(line_start, i - line_start + 1); |
| 4278 | } |
| 4279 | line_start = i + 1; |
| 4280 | } |
| 4281 | } |
| 4282 | if (line_start != length()) { |
| 4283 | new_string += p_prefix + substr(line_start); |
| 4284 | } |
| 4285 | return new_string; |
| 4286 | } |
| 4287 | |
| 4288 | String String::dedent() const { |
| 4289 | String new_string; |
no outgoing calls
no test coverage detected