MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / string_join_variadic

Function string_join_variadic

string/std_string.c:3302–3338  ·  view source on GitHub ↗

* @brief This function joins `count` String objects together into a single String object. * The String objects are passed as variadic arguments. If memory allocation fails, * the function returns NULL and logs an error. * * @param count The number of String objects to join. * @param ... The String objects to be joined. * * @return A new String object containing the concatenated content,

Source from the content-addressed store, hash-verified

3300 */
3301bool string_is_alnum(const String* str) {
3302 STRING_LOG("[string_is_alnum]: Function start.");
3303 if (!str) {
3304 STRING_LOG("[string_is_alnum]: Error - str is NULL.");
3305 return false;
3306 }
3307
3308 size_t str_size = string_length(str);
3309 if (str_size == 0) {
3310 STRING_LOG("[string_is_alnum]: Empty string - returning false.");
3311 return false;
3312 }
3313
3314 for (size_t i = 0; i < str_size; i++) {
3315 char ch = string_at(str, i);
3316 if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))) {
3317 STRING_LOG("[string_is_alnum]: Non-alphanumeric character found at index %zu - returning false.", i);
3318 return false;
3319 }
3320 }
3321
3322 STRING_LOG("[string_is_alnum]: String is alphanumeric - returning true.");
3323 return true;
3324}
3325
3326
3327/**
3328 * @brief Checks if the given String object is in title case.
3329 *
3330 * A string is considered to be in title case if every word starts with an uppercase letter
3331 * and all subsequent characters in the word are lowercase. Non-alphabetic characters such as
3332 * punctuation and numbers are allowed and do not affect the title case condition.
3333 *
3334 * `Words are separated by spaces.`
3335 *
3336 * @param str A pointer to the String object to check.
3337 *
3338 * @return Returns `true` if the string is in title case, `false` otherwise.
3339 */
3340bool string_is_title(const String* str) {
3341 STRING_LOG("[string_is_title]: Function start.");

Callers

nothing calls this directly

Calls 1

string_createFunction · 0.85

Tested by

no test coverage detected