{"id":20273589,"url":"https://github.com/astropilot/string","last_synced_at":"2026-06-05T04:31:23.134Z","repository":{"id":91469960,"uuid":"482226568","full_name":"Astropilot/string","owner":"Astropilot","description":"A header-only pure C library to manipulate more easily string in C for my personal usage","archived":false,"fork":false,"pushed_at":"2022-12-19T15:34:17.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T03:57:48.539Z","etag":null,"topics":["c","c-library","header-only","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Astropilot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-16T10:42:58.000Z","updated_at":"2022-04-16T23:31:01.000Z","dependencies_parsed_at":"2023-07-17T03:15:44.692Z","dependency_job_id":null,"html_url":"https://github.com/Astropilot/string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Astropilot/string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astropilot%2Fstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astropilot%2Fstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astropilot%2Fstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astropilot%2Fstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Astropilot","download_url":"https://codeload.github.com/Astropilot/string/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astropilot%2Fstring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33930307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c-library","header-only","string-manipulation"],"created_at":"2024-11-14T12:49:33.610Z","updated_at":"2026-06-05T04:31:23.117Z","avatar_url":"https://github.com/Astropilot.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\r\n  \u003cbr\u003e\r\n  Simple Strings for C\r\n\u003c/h1\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://github.com/Astropilot/string/actions?query=workflow%3ATests\"\u003e\r\n        \u003cimg src=\"https://github.com/Astropilot/string/workflows/Tests/badge.svg\" alt=\"Test\"\u003e\r\n    \u003c/a\u003e\r\n    \u003ca href=\"https://codecov.io/gh/Astropilot/string\" target=\"_blank\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/codecov/c/github/Astropilot/string?color=%2334D058\" alt=\"Coverage\"\u003e\r\n    \u003c/a\u003e\r\n    \u003cimg src=\"https://img.shields.io/badge/language-C-blue.svg\"\u003e\r\n    \u003ca href=\"https://github.com/Astropilot/string/blob/main/LICENSE\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/github/license/Astropilot/string\" alt=\"MIT License\"\u003e\r\n    \u003c/a\u003e\r\n    \u003cimg src=\"https://img.shields.io/badge/made%20with-%E2%9D%A4%EF%B8%8F-yellow.svg\"\u003e\r\n\u003c/p\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"#about\"\u003eAbout\u003c/a\u003e •\r\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\r\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e •\r\n  \u003ca href=\"#authors\"\u003eAuthors\u003c/a\u003e •\r\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## About\r\n\r\nA header-only pure C library to manipulate more easily string in C for my personal usage.\r\n\r\nThis library is under development and some functions are not/partially implemented, please do not use this library for serious projects.\r\n\r\nAlthough I try to pay attention to the performance of the functions, this library does not aim to provide the best in terms of speed or memory saving.\r\n\r\n## Usage\r\n\r\n```c\r\n#define SIMPLE_STRING_IMPL\r\n#include \"string.h\"\r\n\r\n#include \u003cstdio.h\u003e\r\n#include \u003cstring.h\u003e\r\n\r\nint main(void) {\r\n    // Define strings easily from old school char arrays\r\n    string my_string = STR(\"Hello\"); // Use macro shortcut\r\n    string my_string2 = spls_new_string(\" World\"); // Or full function\r\n\r\n    // Concatenation!\r\n    APPEND_STR(my_string, my_string2);\r\n    APPEND_ARR(my_string, \"!\");\r\n\r\n    // Access to the length of the string is O(1)\r\n    printf(\"String \\\"%s\\\" of size %lu\\n\", my_string, spls_len(my_string));\r\n\r\n    string copy = CLONE(my_string); // Easy copy!\r\n\r\n    if (strcmp(my_string, copy) == 0) {\r\n        printf(\"The two strings are equals!\\n\");\r\n    }\r\n\r\n    // Modify string easily\r\n    copy[0] = 'B';\r\n\r\n    printf(\"Copy \\\"%s\\\" of size %lu\\n\", copy, spls_len(copy));\r\n\r\n    if (strcmp(my_string, copy) != 0) {\r\n        printf(\"The two strings are not equals!\\n\");\r\n    }\r\n\r\n    // Do not forget to free your strings\r\n    spls_free_string(my_string);\r\n    spls_free_string(my_string2);\r\n    spls_free_string(copy);\r\n\r\n    return 0;\r\n}\r\n```\r\n\r\n**Important**: Never use `string` in libc or third-party functions that will change\r\nthe size of the string! All subsequents call to my library will mostly fail or give\r\nundesired behaviors!\r\n\r\n### All functions\r\n\r\nFull documentation will come later...\r\n\r\n```c\r\nstring spls_new_string(const char *str);\r\n\r\nvoid spls_free_string(string str);\r\n\r\nstring spls_clone(const string str);\r\n\r\nsize_t spls_len(const string str);\r\n\r\nstring spls_append_string(string str, string to_append);\r\n\r\nstring spls_append_array(string str, const char *to_append);\r\n\r\nstring spls_capitalize(const string str);\r\n\r\nstring spls_tolower(const string str);\r\n\r\nstring spls_toupper(const string str);\r\n\r\nunsigned int spls_count(const string str, const string search, unsigned int start, unsigned int end);\r\n\r\nbool spls_startswith(const string str, const string value);\r\n\r\nbool spls_endswith(const string str, const string value);\r\n\r\nint spls_find(const string str, const string search, unsigned int start, unsigned int end);\r\n\r\nbool spls_isalnum(const string str);\r\n\r\nbool spls_isalpha(const string str);\r\n\r\nbool spls_isdigit(const string str);\r\n\r\nbool spls_islower(const string str);\r\n\r\nbool spls_isupper(const string str);\r\n\r\nbool spls_isprintable(const string str);\r\n\r\nbool spls_isspace(const string str);\r\n\r\nstring spls_strip(const string str, const string characters);\r\n\r\nstring spls_lstrip(const string str, const string characters);\r\n\r\nstring spls_rstrip(const string str, const string characters);\r\n\r\nstring spls_replace(const string str, const string old_value, const string new_value, unsigned int count);\r\n\r\nstring* spls_split(const string str, const string separator, unsigned int maxsplit);\r\n\r\nstring* spls_splitlines(const string str, bool keeplinebreaks);\r\n\r\nstring spls_substring(const string str, unsigned int start_index, unsigned int end_index);\r\n```\r\n\r\n## Contributing\r\n\r\nThe project is open for contributions! [Open an Issue](https://github.com/Astropilot/string/issues/new) to propose new features/report a bug or directly make a pull request if you want to implement/fix it yourself. Please respect the conventions defined by editorconfig!\r\n\r\n## Authors\r\n\r\n|            |               Github profile                |   Discord   |\r\n| ---------- | :-----------------------------------------: | :---------: |\r\n| Astropilot | [Astropilot](https://github.com/Astropilot) | [Anos]#2347 |\r\n\r\n## License\r\n\r\nMIT - See LICENSE file\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropilot%2Fstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastropilot%2Fstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastropilot%2Fstring/lists"}