Skip to content

Commit 1a4ae51

Browse files
Update cstring.h
1 parent 931c84a commit 1a4ae51

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

code/logic/fossil/io/cstring.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,30 @@ cstring fossil_io_cstring_pad_left(ccstring str, size_t total_length, char pad_c
225225
*/
226226
cstring fossil_io_cstring_pad_right(ccstring str, size_t total_length, char pad_char);
227227

228+
/**
229+
* @brief Performs a case-insensitive comparison of two C strings.
230+
*
231+
* Compares the characters of `str1` and `str2` one by one, ignoring case.
232+
*
233+
* @param str1 The first null-terminated string to compare.
234+
* @param str2 The second null-terminated string to compare.
235+
* @return 1 if the strings are equal (case-insensitive), 0 otherwise.
236+
*/
237+
int fossil_io_cstring_icmp(ccstring str1, ccstring str2);
238+
239+
/**
240+
* @brief Checks if a substring is contained within a string (case-insensitive).
241+
*
242+
* Iterates through `str` and checks if `substr` occurs at any position, ignoring case.
243+
*
244+
* @param str The null-terminated string to search within.
245+
* @param substr The null-terminated substring to search for.
246+
* @return 1 if `substr` is found within `str` (case-insensitive), 0 otherwise.
247+
*/
248+
int fossil_io_cstring_icontains(ccstring str, ccstring substr);
249+
250+
// String Stream
251+
228252
/**
229253
* @brief Creates a new cstring stream with the specified initial size.
230254
*

0 commit comments

Comments
 (0)