{"id":15032806,"url":"https://github.com/ruby/scanf","last_synced_at":"2025-10-19T22:32:09.971Z","repository":{"id":19915714,"uuid":"88256988","full_name":"ruby/scanf","owner":"ruby","description":"scanf is an implementation of the C function scanf(3).","archived":false,"fork":false,"pushed_at":"2025-08-19T02:53:14.000Z","size":89,"stargazers_count":11,"open_issues_count":0,"forks_count":11,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-10-17T08:58:27.043Z","etag":null,"topics":["ruby","scanf"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2017-04-14T10:05:19.000Z","updated_at":"2025-08-19T02:53:17.000Z","dependencies_parsed_at":"2024-06-18T20:04:29.582Z","dependency_job_id":"86028524-bd2c-4ae2-afbc-46c4db32e2c5","html_url":"https://github.com/ruby/scanf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ruby/scanf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fscanf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fscanf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fscanf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fscanf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/scanf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fscanf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279913500,"owners_count":26243070,"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-10-19T02:00:07.647Z","response_time":64,"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":["ruby","scanf"],"created_at":"2024-09-24T20:19:29.285Z","updated_at":"2025-10-19T22:32:09.641Z","avatar_url":"https://github.com/ruby.png","language":"Ruby","readme":"# scanf\n\n`scanf` is an implementation of the C function `scanf(3)`, modified as necessary for Ruby compatibility.\n\nThe methods provided are `String#scanf`, `IO#scanf`, and `Kernel#scanf`. `Kernel#scanf` is a wrapper around `STDIN.scanf`.  `IO#scanf` can be used on any IO stream, including file handles and sockets. `scanf` can be called either with or without a block.\n\nScanf scans an input string or stream according to a \u003cb\u003eformat\u003c/b\u003e, as described below in Conversions, and returns an array of matches between the format and the input.  The format is defined in a string, and is similar (though not identical) to the formats used in `Kernel#printf` and `Kernel#sprintf`.\n\nThe format may contain \u003cb\u003econversion specifiers\u003c/b\u003e, which tell scanf what form (type) each particular matched substring should be converted to (e.g., decimal integer, floating point number, literal string,\netc.)  The matches and conversions take place from left to right, and the conversions themselves are returned as an array.\n\nThe format string may also contain characters other than those in the conversion specifiers.  Whitespace (blanks, tabs, or newlines) in the format string matches any amount of whitespace, including none, in the input.  Everything else matches only itself.\n\nScanning stops, and scanf returns, when any input character fails to match the specifications in the format string, or when input is exhausted, or when everything in the format string has been\nmatched. All matches found up to the stopping point are returned in the return array (or yielded to the block, if a block was given).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'scanf'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install scanf\n\n## Usage\n\n```ruby\nrequire 'scanf'\n\n# String#scanf and IO#scanf take a single argument, the format string\narray = a_string.scanf(\"%d%s\")\narray = an_io.scanf(\"%d%s\")\n\n# Kernel#scanf reads from STDIN\narray = scanf(\"%d%s\")\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ruby/scanf.\n\n## License\n\nThe gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fscanf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fscanf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fscanf/lists"}