MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / String_InsertAt

Function String_InsertAt

src/String.c:304–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void String_InsertAt(cc_string* str, int offset, char c) {
305 int i;
306
307 if (offset < 0 || offset > str->length) {
308 Process_Abort("Offset for InsertAt out of range");
309 }
310 if (str->length == str->capacity) {
311 Process_Abort("Cannot insert character into full string");
312 }
313
314 for (i = str->length; i > offset; i--) {
315 str->buffer[i] = str->buffer[i - 1];
316 }
317 str->buffer[offset] = c;
318 str->length++;
319}
320
321void String_DeleteAt(cc_string* str, int offset) {
322 int i;

Callers 4

LInput_AppendFunction · 0.85
InputWidget_AppendCharFunction · 0.85
InputWidget_BackspaceKeyFunction · 0.85
Http_AddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected