{"id":42298301,"url":"https://github.com/jurgen-kluft/cstring","last_synced_at":"2026-01-27T10:17:04.314Z","repository":{"id":57541338,"uuid":"113550712","full_name":"jurgen-kluft/cstring","owner":"jurgen-kluft","description":"string library (WIP = work in progress)","archived":false,"fork":false,"pushed_at":"2025-12-20T06:36:43.000Z","size":296,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-15T05:44:00.081Z","etag":null,"topics":["cpp","cross-platform","string","utf-16","utf-32","utf-8","view"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jurgen-kluft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-12-08T08:26:32.000Z","updated_at":"2025-12-20T06:36:46.000Z","dependencies_parsed_at":"2025-12-20T10:04:34.783Z","dependency_job_id":null,"html_url":"https://github.com/jurgen-kluft/cstring","commit_stats":{"total_commits":112,"total_committers":3,"mean_commits":"37.333333333333336","dds":0.3303571428571429,"last_synced_commit":"67c2afea0d917eddd3587a43753208d978060dea"},"previous_names":["jurgen-kluft/xstring"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jurgen-kluft/cstring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurgen-kluft%2Fcstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurgen-kluft%2Fcstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurgen-kluft%2Fcstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurgen-kluft%2Fcstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jurgen-kluft","download_url":"https://codeload.github.com/jurgen-kluft/cstring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurgen-kluft%2Fcstring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28811583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cpp","cross-platform","string","utf-16","utf-32","utf-8","view"],"created_at":"2026-01-27T10:17:03.817Z","updated_at":"2026-01-27T10:17:04.306Z","avatar_url":"https://github.com/jurgen-kluft.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# string_t\n\nCross platform string library (BETA; still under construction)\n\nThis string internally uses UTF-16 and only the Basic Multilingual Plane (BMP) \nis supported, it is reference counted and supports modifying whereby other reference \nstrings will be corrected.\nSince we now can have multiple views on the string we can do away with the user\nmanaging indices. However the string may re-allocate when an operation is causing\nit to resize; this includes 'insert', 'replace' and 'remove'.\nWhen this happens all of the active views are automatically 'corrected'. A slice\nmight get invalidated if the operation is 'removing' the part of the string that\nthe slice is watching.\n\nInstead we can do things like this:\n\n``` c++\nstring_t str(\"This is an ascii converted to UTF-16 when constructed\");\nstring_t sl = str.slice();\n\nstring_t tofind = sl(11,16); // select \"ascii\"\n// or\nstring_t tofind = s1.find(\"ascii\");\n\nstring_t ascii_subslice = find(sl, tofind);\nupper(ascii_subslice);    // 'ascii' to 'ASCII'\n\n// This inserts \" string\" into the main string at the location indicated by @ascii_subslice\n// which gets the string to resize, the view @ascii_subslice will still be correct.\nstring_t toinsert(\" string\");\nascii_subslice = insert_after(sl, ascii_subslice, toinsert.slice());\n\n// So now @str = \"This is an ASCII string converted to UTF-16 when constructed\"\n// And @ascii_subslice = \"ASCII\"\n```\n\nOne thing to keep in mind is that a slice can be invalidated when the actual string is\nresized due to insert, replace or remove calls, so know what you are doing. It is just\nsomething to be aware of, invalidated views can still be used and will not cause any\ncrashes, they will just be empty.\n\nYou can clone a string (string data is copied):\n\n``` c++\nstring_t a_copy = str.clone();\nstring_t a_slice = a_copy.slice();\nstring_t tofind2(\" when constructed\")\nstring_t to_remove = find(a_slice, tofind2.slice());\nremove(a_slice, to_remove);  // This removes the substring from the main string\n// So now @a_copy = \"This is an ASCII string converted to UTF-16\"\n// @to_remove is invalidated since that part does not exist anymore.\n\n// If you want to lower-case the first letter of 'This'\nstring_t to_lower = a_slice(1);\nlower(to_lower);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurgen-kluft%2Fcstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjurgen-kluft%2Fcstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurgen-kluft%2Fcstring/lists"}