{"id":14070955,"url":"https://github.com/retailcoder/VBA-StringBuilder","last_synced_at":"2025-07-30T08:33:45.931Z","repository":{"id":88199680,"uuid":"153720996","full_name":"retailcoder/VBA-StringBuilder","owner":"retailcoder","description":"A 100% VBA StringBuilder class","archived":false,"fork":false,"pushed_at":"2018-10-19T04:09:43.000Z","size":11,"stargazers_count":38,"open_issues_count":3,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-23T07:15:20.340Z","etag":null,"topics":["performance","strings","vba"],"latest_commit_sha":null,"homepage":"","language":"Visual Basic","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/retailcoder.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}},"created_at":"2018-10-19T03:22:32.000Z","updated_at":"2025-02-27T00:55:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"0b9ebe9f-b647-4a82-bf56-e37e5b680a05","html_url":"https://github.com/retailcoder/VBA-StringBuilder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/retailcoder/VBA-StringBuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retailcoder%2FVBA-StringBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retailcoder%2FVBA-StringBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retailcoder%2FVBA-StringBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retailcoder%2FVBA-StringBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retailcoder","download_url":"https://codeload.github.com/retailcoder/VBA-StringBuilder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retailcoder%2FVBA-StringBuilder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267835907,"owners_count":24151888,"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-30T02:00:09.044Z","response_time":70,"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":["performance","strings","vba"],"created_at":"2024-08-13T07:08:12.306Z","updated_at":"2025-07-30T08:33:45.667Z","avatar_url":"https://github.com/retailcoder.png","language":"Visual Basic","readme":"# VBA-StringBuilder\n\nA `StringBuilder` class based on the work of @Blackhawk, published under CC-BY-SA on [Code Review Stack Exchange](https://codereview.stackexchange.com/q/67596/23788).\n\nConcatenating strings in a loop is a very inefficient process. Using a `StringBuilder` for concatenating a large number of strings makes the code much more efficient and noticeably enhances performance.\n\n- 1K strings; both concat \u0026 builder are pretty much instant\n- 10K strings; both concat \u0026 builder complete in ~0.05 seconds\n- 20K strings; very similar performance, ~0.1 seconds for both\n- 50K strings; concat ~0.65 seconds, builder ~0.2 seconds\n- 100K strings; concat ~2.7 seconds, builder ~0.4 seconds\n- 1M strings; concat ????\\*, builder ~4.9 seconds\n\n\u003csub\u003e\\*Gave up, killed the process after 10 minutes.\u003c/sub\u003e\n\n## Usage\n\nWith the `StringBuilder` class added to your VBA project, use the `New` keyword to create a new instance of the class:\n\n```vb\nDim sb As StringBuilder\nSet sb = New StringBuilder\n```\n\nThis initializes the builder with a default initial capacity.\nTo specify an initial capacity and/or initial content, or to create an instance of the class from a VBA project that's referencing the VBA project the `StringBuilder` class is loaded from (e.g. an add-in), use the `Create` factory method off the *default instance* instead:\n\n```vb\nDim sb As StringBuilder\nSet sb = StringBuilder.Create(\"test\", 32)\n```\n\nUse the `Append` method to, well, *append* a string to the builder; use the `ToString` method to retrieve the string:\n\n```vb\nDim sb As StringBuilder\nSet sb = StringBuilder.Create\n\nDim i As Long\nFor i = 1 To 100000\n    sb.Append \"Test\"\nNext\nDebug.Print sb.ToString\n```\n\nInstance members cannot be invoked from the *default instance*.\n","funding_links":[],"categories":["Visual Basic"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretailcoder%2FVBA-StringBuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretailcoder%2FVBA-StringBuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretailcoder%2FVBA-StringBuilder/lists"}