MCPcopy Create free account
hub / github.com/cococry/leif / insert_i_str

Function insert_i_str

leif.c:1458–1472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456}
1457
1458void insert_i_str(char *str, char ch, int32_t index) {
1459 int len = strlen(str);
1460
1461 if (index < 0 || index > len) {
1462 LF_ERROR("Invalid string index for inserting.\n");
1463 return;
1464 }
1465
1466 for (int i = len; i > index; i--) {
1467 str[i] = str[i - 1];
1468 }
1469
1470 str[index] = ch;
1471 str[len + 1] = '\0';
1472}
1473
1474void insert_str_str(char* source, const char* insert, int32_t index) {
1475 int source_len = strlen(source);

Callers 2

input_fieldFunction · 0.85
lf_input_insert_char_idxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected