Strutil is a simple string library that I've been using to supplement the string functions in the C Standard Library.
contains: Tests if a sequence is contained in a string.ends_with: Tests if a string ends with a given token.index_of: Gets the FIRST index of a character within a string.indices_of: Gets ALL indexes of a character withing a stringinsert: Inserts a string at the specified index.lcs: Computes the Longest Common Subsequence of a pair of strings.lowercase: Sets all letters to lowercase.remove: Removes characters from a string in the given range.remove_each: Removes all given characters from a string.replace_all: Replaces each occurence of a character with a new character in a string.reverse: Reverses the contents of a string.split: Splits a string at each occurence of a token. Returns an array of Strings.starts_with: Tests if a string starts with a given token.substring: Gets a substring within a given range.trim: Trims the leading and trailing spaces in a string.uppercase: Sets all letters to uppercase.
To use Strutil...
- Insert
#include <strutil/strutil.h>into your source file(s). - Compile with the
-lstrutilflag.
- glibc (2.16 or later) (GNU C Library)
- gcc (GNU Compiler Collection) OR clang (Clang/LLVM)
$ make
$ sudo make install
$ sudo make uninstall
- Build debug library (
make debug) from the project root directory. - Clean all executables in the test directory because the static library is used (
make clean). - Build all or which ever test you want (
makeormake <something>).
Submit a pull request! Upon submission I will review any and all changes.
All bugs and other issues should be reported on the github issue tracker.