In the string.h
project, the aim was to create a custom implementation of the string.h
library in the C programming language, enriching it with additional features.
git clone https://github.com/0xmisha/string.h.git
cd string.h/src
make
- Gcc
- Make
- check.h (for tests)
-
Standard string.h Functions: The core part of the project was to replicate the functionality found in the standard
string.h
library. Functions such asmemchr
,memcpy
,strncpy
, andstrtok
are a few to mention. -
sprintf and sscanf Functions: The standard
sprintf
andsscanf
functions, which deal with formatted input and output to and from strings, were also to be implemented. -
Special String Processing Functions: Inspired by the String class in C#, the project also required the addition of some advanced string manipulations. These functions, like
to_upper
,to_lower
,insert
, andtrim
, augment the traditional string processing capabilities. -
Quality Assurance Measures:
- Adherence to the Google coding style was mandated.
- The entire codebase, encompassing headers, the library, and even the Makefile, was to reside in the
src
folder on thedevelop
branch. - The project had a strong emphasis on structured programming, mandating minimal code repetition.
- Unit-testing, with at least 80% coverage per function, was enforced, using the
Check
library. - A
gcov
report in the form of an HTML page was to be generated to validate the coverage.
-
Compliance and Restrictions:
- The C11 standard was to be followed throughout, utilizing the
gcc
compiler. - Direct copying from the standard
string.h
or other string processing libraries was strictly prohibited, barring unit tests. - Functions were supposed to work specifically with single-byte ASCII characters.
- The C11 standard was to be followed throughout, utilizing the
-
Bonus Tasks: For additional credit, participants could implement advanced format modifiers for
sprintf
andsscanf
, and further special string processing functions from the C# String class.
In essence, the s21_string+
project is a comprehensive endeavor to understand, reimplement, and expand upon the classic string.h
library. The meticulous requirements ensure not just functional accuracy, but also coding best practices and rigorous testing.