Implement the solutions to this exercise without using any libary
function other than of the ones in stdio.h
.
void capitalize(char string[]);
that capitalizes the given string.
For example,
char text[] = "The world is beautiful!";
capitalize(text); // `text` becomes "The World Is Beautiful."
Name the source file: capitalize.c
// Return the number of characters in the string excluding the trailing '\0'.
size_t str_len(const char[] s);
// "Hello World!" => "hELLO wORLD!"
void str_inverse_case(char str[]);
// Return true if str starts with prefix, otherwise false.
bool str_starts_with(const char str[], const char prefix[]);
// true if str ends with suffix
bool str_ends_with(const char str[], const char suffix[]);
// number of occurences of sub in text
unsigned str_count(const char str[], const char sub[]);
// true if string only has ascii chars (not extended ascii)
bool str_is_ascii(const char str[]);
// true if string only has digits
bool str_is_digit(const char str[]);
// position of first occurance of sub in str | -1
long str_index(const char str[], const char sub[]);
Design multiple appropriate test cases (input output combinations) before
implementing the above functions. Call the functions from within
main(.)
to make sure that the test cases pass.