StrCharAt
Description
Access the character at idx by value. Caller must ensure idx < length.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in | String to query. |
idx |
in | Index in [0, length). |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:245:
// after it. Otherwise insert at the start of the content.
size insert_pos = content_start;
if (content_len > 0 && (StrCharAt(o, content_start) == '-' || StrCharAt(o, content_start) == '+')) {
insert_pos += 1;
}- In
Float.c:650:
if (split > 0) {
for (i64 i = 0; i < split; i++) {
if (!StrPushBackR(&result, StrCharAt(&digits, i))) {
goto fail;
}- In
Float.c:660:
for (u64 i = (u64)split; i < StrLen(&digits); i++) {
if (!StrPushBackR(&result, StrCharAt(&digits, i))) {
goto fail;
}- In
Str.c:176:
for (idx = 0; idx < StrLen(str); idx++) {
hash ^= (u64)(unsigned char)StrCharAt(str, idx);
hash *= 1099511628211ULL;
}- In
Int.c:643:
}
if (StrLen(decimal) > 0 && StrCharAt(decimal, 0) == '+') {
start = 1;
}- In
Int.c:701:
LOG_FATAL("Invalid arguments");
}
if (StrLen(digits) > 0 && StrCharAt(digits, 0) == '+') {
start = 1;
}- In
Int.c:812:
}
if (StrLen(binary) >= 2 && StrCharAt(binary, 0) == '0' &&
(StrCharAt(binary, 1) == 'b' || StrCharAt(binary, 1) == 'B')) {
start = 2;- In
Int.c:813:
if (StrLen(binary) >= 2 && StrCharAt(binary, 0) == '0' &&
(StrCharAt(binary, 1) == 'b' || StrCharAt(binary, 1) == 'B')) {
start = 2;
}- In
Int.c:861:
}
if (StrLen(octal) >= 2 && StrCharAt(octal, 0) == '0' &&
(StrCharAt(octal, 1) == 'o' || StrCharAt(octal, 1) == 'O')) {
start = 2;- In
Int.c:862:
if (StrLen(octal) >= 2 && StrCharAt(octal, 0) == '0' &&
(StrCharAt(octal, 1) == 'o' || StrCharAt(octal, 1) == 'O')) {
start = 2;
}- In
KvConfig.c:197:
while (StrIterPeek(&si, &c) && c != '\n') {
if (kvconfig_is_comment_start(c) && StrLen(value) > 0 &&
kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
char dropped = '\0';- In
KvConfig.c:198:
if (kvconfig_is_comment_start(c) && StrLen(value) > 0 &&
kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
char dropped = '\0';
StrPopBack(value, &dropped);- In
Str.Access.c:123:
// Test StrCharAt function
bool test_str_char_at(void) {
WriteFmt("Testing StrCharAt\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Access.c:131:
// Access characters at different indices
// Now using the fixed StrCharAt macro
char c0 = StrCharAt(&s, 0);
char c1 = StrCharAt(&s, 1);
char c2 = StrCharAt(&s, 2);- In
Str.Access.c:132:
// Now using the fixed StrCharAt macro
char c0 = StrCharAt(&s, 0);
char c1 = StrCharAt(&s, 1);
char c2 = StrCharAt(&s, 2);
char c3 = StrCharAt(&s, 3);- In
Str.Access.c:133:
char c0 = StrCharAt(&s, 0);
char c1 = StrCharAt(&s, 1);
char c2 = StrCharAt(&s, 2);
char c3 = StrCharAt(&s, 3);
char c4 = StrCharAt(&s, 4);- In
Str.Access.c:134:
char c1 = StrCharAt(&s, 1);
char c2 = StrCharAt(&s, 2);
char c3 = StrCharAt(&s, 3);
char c4 = StrCharAt(&s, 4);- In
Str.Access.c:135:
char c2 = StrCharAt(&s, 2);
char c3 = StrCharAt(&s, 3);
char c4 = StrCharAt(&s, 4);
// Check that the characters are correct
Last updated on