StrPushFront
- Macro
- August 22, 2025
Table of Contents
StrPushFront
StrPushFront
Description
Push char into string front.
Parameters
Name | Direction | Description |
---|---|---|
str | in | Str to push char into |
chr | in | Pointer to value to be pushed |
Success
Returns str
the string itself on success.
Failure
Returns NULL
otherwise.
Usage example (Cross-references)
- In
Io.c:194
:
// Pad on left
for (size i = 0; i < pad_len; i++) {
StrPushFront(o, ' ');
}
} else if (align == ALIGN_LEFT) {
- In
Io.c:207
:
// Pad on left
for (size i = 0; i < left_pad; i++) {
StrPushFront(o, ' ');
}
- In
Io.c:801
:
// Ensure 2 digits with leading zero
if (hex.length == 1) {
StrPushFront(&hex, '0');
}
StrPushBackZstr(o, "0x");
- In
Io.c:871
:
// Ensure 2 digits with leading zero
if (hex.length == 1) {
StrPushFront(&hex, '0');
}
StrPushBackZstr(o, "0x");
- In
MisraDoc.c:206
:
// complete relative file path
StrPushFront(&output_path, '/');
LOG_INFO("{}", output_path);
StrPushFrontCstr(&output_path, project.build_dir.data, project.build_dir.length);
- In
Str.Insert.c:225
:
// Test StrPushFront function
bool test_str_push_front(void) {
printf("Testing StrPushFront\n");
Str s = StrInitFromZstr("World");
- In
Str.Insert.c:230
:
// Push characters at the front
StrPushFront(&s, ' ');
StrPushFront(&s, 'o');
StrPushFront(&s, 'l');
- In
Str.Insert.c:231
:
// Push characters at the front
StrPushFront(&s, ' ');
StrPushFront(&s, 'o');
StrPushFront(&s, 'l');
StrPushFront(&s, 'l');
- In
Str.Insert.c:232
:
StrPushFront(&s, ' ');
StrPushFront(&s, 'o');
StrPushFront(&s, 'l');
StrPushFront(&s, 'l');
StrPushFront(&s, 'e');
- In
Str.Insert.c:233
:
StrPushFront(&s, 'o');
StrPushFront(&s, 'l');
StrPushFront(&s, 'l');
StrPushFront(&s, 'e');
StrPushFront(&s, 'H');
- In
Str.Insert.c:234
:
StrPushFront(&s, 'l');
StrPushFront(&s, 'l');
StrPushFront(&s, 'e');
StrPushFront(&s, 'H');
- In
Str.Insert.c:235
:
StrPushFront(&s, 'l');
StrPushFront(&s, 'e');
StrPushFront(&s, 'H');
// Check that the characters were inserted correctly