{"id":25854776,"url":"https://github.com/jchristopherson/fstring","last_synced_at":"2026-03-18T00:08:27.431Z","repository":{"id":216372346,"uuid":"741156889","full_name":"jchristopherson/fstring","owner":"jchristopherson","description":"A Fortran string library.","archived":false,"fork":false,"pushed_at":"2025-12-12T15:42:18.000Z","size":674,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-08T20:30:29.326Z","etag":null,"topics":["fortran","string","string-manipulation","strings"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/jchristopherson.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-09T20:16:20.000Z","updated_at":"2025-12-12T15:42:23.000Z","dependencies_parsed_at":"2025-07-24T01:27:08.081Z","dependency_job_id":"1cd6f459-fdff-4089-b960-def320f72432","html_url":"https://github.com/jchristopherson/fstring","commit_stats":null,"previous_names":["jchristopherson/fstring"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jchristopherson/fstring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchristopherson","download_url":"https://codeload.github.com/jchristopherson/fstring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffstring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30636845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T23:56:54.546Z","status":"ssl_error","status_checked_at":"2026-03-17T23:56:28.952Z","response_time":56,"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":["fortran","string","string-manipulation","strings"],"created_at":"2025-03-01T16:18:06.813Z","updated_at":"2026-03-18T00:08:25.386Z","avatar_url":"https://github.com/jchristopherson.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fstring\nA modern Fortran string library.\n\n## Status\n[![CMake](https://github.com/jchristopherson/fstring/actions/workflows/cmake.yml/badge.svg)](https://github.com/jchristopherson/fstring/actions/workflows/cmake.yml)\n[![Actions Status](https://github.com/jchristopherson/fstring/workflows/fpm/badge.svg)](https://github.com/jchristopherson/fstring/actions)\n\n## Building fstring\n[CMake](https://cmake.org/) can be used to build this library.  Use -DBUILD_TESTING=TRUE only if tests are desired.  If tests are not to be built, then simply omit -DBUILD_TESTING.  The default is a release build static library.\n```txt\ncd build\ncmake ../build -DBUILD_TESTING=TRUE\nmake\n```\nFor more detailed instructions see [Running CMake](https://cmake.org/runningcmake/).\n\n[FPM](https://github.com/fortran-lang/fpm) can also be used to build this library using the provided fpm.toml.\n```txt\nfpm build\n```\nThe fstring library can be used within your FPM project by adding the following to your fpm.toml file.\n```toml\n[dependencies]\nfstring = { git = \"https://github.com/jchristopherson/fstring\" }\n```\n\n## Documentation\nDocumentation can be found [here](https://jchristopherson.github.io/fstring/).\n\n## Example 1\nThe following example illustrates the a subset of the functionallity of the library along with the string type and its interoperability with the traditional character type.\n```fortran\nprogram example\n    use strings\n    use iso_fortran_env, only : int32\n    implicit none\n\n    ! Variables\n    character(len = *), parameter :: str = \"This is an example string of type character.\"\n    type(string) :: str1\n    integer(int32), allocatable, dimension(:) :: indices\n\n    ! Replace character with type(string)\n    str1 = replace(str, \"character\", \"type(string)\")\n    print \"(A)\", char(str1) ! char is required as print doesn't recognize type(string)\n\n    ! Print the original string\n    print \"(A)\", str\n\n    ! Ensure they are not equal\n    print \"(AL)\", \"str /= str1: \", str /= str1\n\n    ! Find all locations of the substring \"string\"\n    indices = find(str1, \"string\")  ! notice the use of mixed types (type(string) \u0026 character)\n    print \"(AI0AI0)\", \"Index 1: \", indices(1), \", Index 2: \", indices(2)\n\n    ! Convert a numeric value to a string\n    print \"(A)\", char(to_string(1.234d0)) ! char is required as print doesn't recognize type(string)\n    print \"(A)\", char(to_string(1.234d0, \"(F5.3)\")) ! specifying the format\n\n    ! Convert a string to a number\n    print \"(F5.3)\", string_to_real(\"1.234\")\nend program\n```\nThe output from the above program is as follows.\n```text\nThis is an example string of type type(string)\nThis is an example string of type character.\nstr /= str1: T\nIndex 1: 20, Index 2: 40\n1.23400\n1.234\n1.234\n```\n\n## Example 2\nThe following example illustrates building up a string via concatenation vs. using the string_builder type.  For situations where relatively few strings need to be brought together into one, the built-in concatenation operator is the way to go; however, as the number of strings increases, the string_builder type begins to make much more sense.  This is partially due to the design of the string_builder type, which uses an internal buffer.  This internal buffer can allow for simple copying options vs. additional allocations.  In certain instances this feature can be advantageous.  The example below does not illustrate such a case.  Instead, it merely shows the basics of operation.  Regardless, as can be seen, the string_builder type is simple to use and can be easily extended to more complex scenarios.\n```fortran\nprogram example\n    use strings\n    implicit none\n\n    ! Variables\n    character(len = *), parameter :: str1 = \"This is the first string.\"\n    character(len = *), parameter :: str2 = \"This is the second string.\"\n    character(len = :), allocatable :: str\n    type(string_builder) :: sb\n\n    ! Use typical string concatenation to build up the string\n    str = str1 // \" \" // str2\n    print \"(A)\", str\n\n    ! Using string_builder\n    call sb%append(str1)\n    call sb%append(\" \")\n    call sb%append(str2)\n    print \"(A)\", char(sb%to_string()) ! to_string returns a type(string) which needs to be converted to character by char for the print statement\nend program\n```\nThe output from the above program is as follows.\n```text\nThis is the first string. This is the second string.\nThis is the first string. This is the second string.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchristopherson%2Ffstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchristopherson%2Ffstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchristopherson%2Ffstring/lists"}