Welcome to strings.c
! This project contains a self-implementation of the strings.h
header file, which provides various string manipulation functions. As the famous quote goes, "You don't fully understand something until you build it," So I tried building it.
The motivation behind this project is to enhance our knowledge of C programming and improve our understanding of string handling. By building our own version of the strings.h
library, we can explore the underlying concepts and algorithms used in these functions.
Below is a list of the functions we have implemented in strings.c
:
str_len()
: Calculates the length of a given string.str_lwr()
: Converts a string to lowercase.str_upr()
: Converts a string to uppercase.str_cmp()
: Compares two strings (ASCII Difference) and calculates the difference.str_cat()
: Concatenates two strings.
The following functions are yet to be implemented:
str_cpy(char *dest, const char *src)
: Copies the contents of one string to another.str_chr(const char *str, int c)
: Locates the first occurrence of a character in a string.str_str(const char *haystack, const char *needle)
: Finds the first occurrence of a sub string in a string.
To use the functions provided by strings.c
, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/strings.c.git
cd strings.c
- Compile your program along with
strings.c
:
gcc -o strings strings.c
- Run the binary:
./strings
If you have ideas for the missing string manipulation functions or find any bugs, feel free to open an issue or submit a pull request.