{"id":15497300,"url":"https://github.com/jwerle/chfreq.c","last_synced_at":"2025-07-31T06:33:20.402Z","repository":{"id":16712661,"uuid":"19469538","full_name":"jwerle/chfreq.c","owner":"jwerle","description":"Compute character frequency in a string","archived":false,"fork":false,"pushed_at":"2014-12-15T19:14:59.000Z","size":170,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T16:50:02.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jwerle.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}},"created_at":"2014-05-05T20:09:25.000Z","updated_at":"2023-02-06T07:30:38.000Z","dependencies_parsed_at":"2022-08-25T13:40:26.495Z","dependency_job_id":null,"html_url":"https://github.com/jwerle/chfreq.c","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jwerle/chfreq.c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fchfreq.c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fchfreq.c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fchfreq.c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fchfreq.c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwerle","download_url":"https://codeload.github.com/jwerle/chfreq.c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fchfreq.c/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267998002,"owners_count":24178434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2024-10-02T08:32:45.111Z","updated_at":"2025-07-31T06:33:20.382Z","avatar_url":"https://github.com/jwerle.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"chfreq.c\n========\n\nCompute character frequency in a string\n\n## install\n\n[clib](https://github.com/clibs/clib):\n\n```sh\n$ clib install jwerle/chfreq.c\n```\n\nsource:\n\n```sh\n$ git clone git@github.com:jwerle/chfreq.c.git\n$ cd chfreq.c\n$ make\n$ make install\n```\n\n## example\n\n```c\n#include \u003cstdlib.h\u003e\n#include \u003cstdint.h\u003e\n#include \u003cstdio.h\u003e\n#include \"chfreq.h\"\n\nint\nmain (void) {\n  char *str = \"aabbcc\";\n  uint32_t freq** = chfreq(str);\n  printf(\"%c %d\\n\", freq[0][0], freq[0][1]);\n  printf(\"%c %d\\n\", freq[1][0], freq[1][1]);\n  printf(\"%c %d\\n\", freq[2][0], freq[2][1]);\n  return 0;\n}\n```\n\n...yields:\n\n```\na 2\nb 2\nc 2\n```\n\nWith the command line utility:\n\n```sh\n$ echo -n aabbcc | chfreq\na | 2\nb | 2\nc | 2\n```\n\n```sh\n$ echo -n 'kinkajous are awesome !'| chfreq\nk | 2\ni | 1\nn | 1\na | 3\nj | 1\no | 2\nu | 1\ns | 2\n  | 3\nr | 1\ne | 3\nw | 1\nm | 1\n! | 1\n```\n\n```sh\n$ echo -n werle | chfreq -f '%c(%d)'\nw(1)\ne(2)\nr(1)\nl(1)\n```\n\n## api\n\n```c\nuint32_t **\nchfreq (const char *src);\n```\n\nReturns an array of `uint32_t' type arrays who's character is the first index\nand the occurence is the second index.\n\n**example structure:**\n\n```c\nuint32_t mat[2][2] = {\n  {'a', 2},\n  NULL\n}\n```\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Fchfreq.c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwerle%2Fchfreq.c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Fchfreq.c/lists"}