{"id":33927387,"url":"https://github.com/floating-floaties/string-utility","last_synced_at":"2025-12-12T10:58:59.897Z","repository":{"id":61080394,"uuid":"548163166","full_name":"floating-floaties/string-utility","owner":"floating-floaties","description":" Provides simple substring implementation (with the RangeBound trait), keep string before or after a specified string, etc. ","archived":false,"fork":false,"pushed_at":"2025-03-14T08:44:17.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-27T02:28:41.630Z","etag":null,"topics":["keep-after","keep-before","range","range-bound","rust","strings","substring","substring-trait","trait"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/string-utility","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floating-floaties.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":"2022-10-09T02:59:02.000Z","updated_at":"2025-03-14T08:44:21.000Z","dependencies_parsed_at":"2022-10-10T01:25:46.435Z","dependency_job_id":null,"html_url":"https://github.com/floating-floaties/string-utility","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/floating-floaties/string-utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating-floaties%2Fstring-utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating-floaties%2Fstring-utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating-floaties%2Fstring-utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating-floaties%2Fstring-utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floating-floaties","download_url":"https://codeload.github.com/floating-floaties/string-utility/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating-floaties%2Fstring-utility/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27681537,"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-12-12T02:00:06.775Z","response_time":129,"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":["keep-after","keep-before","range","range-bound","rust","strings","substring","substring-trait","trait"],"created_at":"2025-12-12T10:58:54.786Z","updated_at":"2025-12-12T10:58:59.889Z","avatar_url":"https://github.com/floating-floaties.png","language":"Rust","readme":"# Simple Substring Trait\n\n\u003c!-- TOC --\u003e\n* [Simple Substring Trait](#simple-substring-trait)\n  * [Install](#install)\n  * [Usage](#usage)\n    * [Substring](#substring)\n    * [Keep](#keep)\n\u003c!-- TOC --\u003e\n\n## Install\n\nAdd the following line to your Cargo.toml file (under `[dependencies]`):\n\n```toml\nstring-utility = \"0.2\"\n```\n\n## Usage\n\n### Import all Traits\n\n```rust\nuse string_utility::prelude::*;\n```\n\n### Substring\n\n```rust\nuse string_utility::prelude::*;\n\nfn main() {\n    let some_text = \"42Hello, world!\".to_string();\n\n    // cut first two chars\n    let result = some_text.substring(2..);\n    let expected = \"Hello, world!\";\n    assert_eq!(result, expected);\n\n    // extract world string\n    let result = some_text.substring(9..=13);\n    let expected = \"world\";\n    assert_eq!(result, expected);\n\n    // keep everything up to (including) idx 13\n    let result = some_text.substring(..=13);\n    let expected = \"42Hello, world\";\n    assert_eq!(result, expected);\n\n    // keep everything up to (excluding) idx 13\n    let result = some_text.substring(..13);\n    let expected = \"42Hello, worl\";\n    assert_eq!(result, expected);\n\n    // keep everything\n    let result = some_text.substring(..);\n    let expected = \"42Hello, world!\";\n    assert_eq!(result, expected);\n\n    // get last char\n    let result = some_text.substring(some_text.len()-1..);\n    let expected = \"!\";\n    assert_eq!(result, expected);\n\n  // get last char\n  let result = some_text.substring_len(1); // same as (len - 1)..usize::MAX\n  let expected = \"!\";\n  assert_eq!(result, expected);\n}\n```\n\n\n### Keep\n\nAll functions: [trait def](https://docs.rs/string-utility/0.2.0/string_utility/trait.StringKeeperExt.html)\n\n```rust\nuse string_utility::prelude::*;\n\nfn main() {\n  let some_text = \"some start value, some not-so-start value\".to_string();\n  \n  let result = some_text\n          .keep(\"start\".to_string())  // keep(pattern)\n          // from the\n          .end_of_string()\n          // whether to keep the pattern \"start\"\n          .excluding_pattern() \n          // keep everything before the pattern\n          .before_pattern()\n          // exec\n          .to_string();\n    let expected = \"some start value, some not-so-\";\n    assert_eq!(result, expected);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloating-floaties%2Fstring-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloating-floaties%2Fstring-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloating-floaties%2Fstring-utility/lists"}