fnoyanisi / zString

A permissive licensed string manipulation library for C.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About zString

zString is a C library providing slightly different functionality than the standard library string processing functions.

zString does not aim to replace standard library string functions, rather introduces new methods with different capabilities (such as zstrtok())

zString is developed by Fehmi Noyan ISI

Using zString

Just include zstring.h in your source file and make sure all the header files are in your include path. For instance, for clang ang gcc you can use -I option to add a directory into your include path.

Unit tests

In order to build unit tests, you need to checkout Unity test suite and have cmake installed on your system.

~ % git clone https://github.com/fnoyanisi/zString.git
~ % cd zString
~/zString % ls
CMakeLists.txt	LICENSE		README.adoc	src		test
~/zString % git clone https://github.com/ThrowTheSwitch/Unity.git unity
~/zString % ls
CMakeLists.txt	README.adoc	test
LICENSE		src		unity
~/zString % mkdir build
~/zString % cd build
~/zString/build % cmake -DBUILD_TESTS=yes ..
~/zString/build % cmake --build .
~/zString/build %

Version History

  • version 1.9 - (Dec 2019)

    • added Unity test suite for unit tests

    • using standard library functions

    • changed function and header file names

    • added doxygen documentation

    • removed zstrtok_q() function

  • version 1.8.3 - (Aug 2018)

    • minor changes to improve run time

    • zstrtrm() reimplemented by using zstrtrm_l() and zstrin_rtrim()

  • version 1.8.2 - (July 2018)

    • gitignore file added

    • several optimizations to reduce the run time

    • some style changes (based on style(9) of FreeBSD)

  • version 1.8.1 - (Jan 2017)

    • Fixed typos in comments and README file

    • LICENSE file added to the repo

    • License for zrmvchr.h has been updated as 2-Clause BSD License

    • Changes in version 1.8.1 submitted by GitHub user tbeu

  • version 1.8 - (Oct 2016)

    • trim family functions are isspace(3) compatible

    • added input validation checks for most of the functions

  • version 1.7 - (Oct 2016)

    • Used const char* instead of char* where possible

    • performed a lint(1) check and cleared discrepancies

  • version 1.6 - (Feb 2016)

    • Library is licensed with 2-Clause BSD License

    • zstrtrm() added

    • zstrtrm_l() added

    • zstrtrm_r() added

  • version 1.5 - (Feb 2016)

    • zstrtok_d() added

    • zrepchr() added

    • zrepstr() added

  • version 1.4 - (Jan 2016)

    • Updated zstrchr() to make the library compatible with llvm/clang

  • version 1.3

    • Bug fixes

  • version 1.2

    • Performance improvements for zrmvchr()

  • version 1.1

    • Additions

  • version 1.0 - (Nov 2012)

    • First version

Functions and Usage

It is enough to include zstring.h in your code. Alternatively, any header file can be included separately in order to use the function defined in it.

Refer the individual header file for the function to get more details on the function usage and arguments.

zstrchr(char *token, char s)

Searches for character s in string token.

zrmvchr(char *str,char *bad)

Removes characters contained in string bad, from string str. Each character in bad is searched separately.

zstrtok(char *str, const char *delim)

An alternative to standard library’s strtok() function that is also capable of handling successive delimiters.

zrepchr(char *str, char x, char y)

Replaces every occurrence of character x with character y within string str.

zrepstr(char *str, char *x, char *y)

Replaces every occurrence of string x with string y within string str.

zstrtrm(char *str)

Trims leading and trailing white-space characters from the character string str.

zstrtrm_l(char *str)

Trims leading white-space characters from the character string str.

zstrtrm_r(char *str)

Trims trailing white-space characters from the character string str.

License

zString can be distributed, modified and used under the terms of 2-clause BSD license.

About

A permissive licensed string manipulation library for C.

License:Other


Languages

Language:C 98.0%Language:CMake 2.0%