https://github.com/tyler-cromwell/strutil
A simple string library to alleviate annoying string manipulation problems in C
https://github.com/tyler-cromwell/strutil
c library string-manipulation
Last synced: 28 days ago
JSON representation
A simple string library to alleviate annoying string manipulation problems in C
- Host: GitHub
- URL: https://github.com/tyler-cromwell/strutil
- Owner: tyler-cromwell
- License: mit
- Created: 2013-09-23T04:29:07.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2018-08-20T14:04:56.000Z (almost 8 years ago)
- Last Synced: 2024-04-16T00:19:04.799Z (about 2 years ago)
- Topics: c, library, string-manipulation
- Language: C
- Homepage:
- Size: 362 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# What is Strutil?
Strutil is a simple string library that I've been using to supplement the string functions in the [C Standard Library][C Standard Library].
## Functions
- `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 string
- `insert`: Inserts a string at the specified index.
- `lcs`: Computes the [Longest Common Subsequence][lcs] 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.
## Usage
To use Strutil...
1. Insert `#include ` into your source file(s).
2. Compile with the `-lstrutil` flag.
## Dependencies
- glibc (2.16 or later) ([GNU C Library][Glibc])
- gcc ([GNU Compiler Collection][GCC]) OR clang ([Clang][Clang]/[LLVM][LLVM])
## How to Install
```
$ make
$ sudo make install
```
## How to Uninstall
```
$ sudo make uninstall
```
## Tests
1. Build debug library (`make debug`) from the project root directory.
2. Clean all executables in the test directory because the static library is used (`make clean`).
3. Build all or which ever test you want (`make` or `make `).
## Contributing
Submit a pull request! Upon submission I will review any and all changes.
## Bugs
All bugs and other issues should be reported on the github issue tracker.
[C Standard Library]: http://en.wikipedia.org/wiki/C_standard_library
[Glibc]: http://en.wikipedia.org/wiki/GNU_C_Library
[GCC]: http://en.wikipedia.org/wiki/GNU_Compiler_Collection
[Clang]: http://en.wikipedia.org/wiki/Clang
[LLVM]: http://en.wikipedia.org/wiki/LLVM
[Gmake]: http://www.gnu.org/software/make/
[lcs]: https://en.wikipedia.org/wiki/Longest_common_subsequence_problem